<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Advanced Features • EJAM</title>
<!-- favicons --><link rel="icon" type="image/png" sizes="16x16" href="../favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="../favicon-32x32.png">
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="../apple-touch-icon.png">
<link rel="apple-touch-icon" type="image/png" sizes="120x120" href="../apple-touch-icon-120x120.png">
<link rel="apple-touch-icon" type="image/png" sizes="76x76" href="../apple-touch-icon-76x76.png">
<link rel="apple-touch-icon" type="image/png" sizes="60x60" href="../apple-touch-icon-60x60.png">
<script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="../deps/bootstrap-5.3.1/bootstrap.min.css" rel="stylesheet">
<script src="../deps/bootstrap-5.3.1/bootstrap.bundle.min.js"></script><link href="../deps/font-awesome-6.4.2/css/all.min.css" rel="stylesheet">
<link href="../deps/font-awesome-6.4.2/css/v4-shims.min.css" rel="stylesheet">
<script src="../deps/headroom-0.11.0/headroom.min.js"></script><script src="../deps/headroom-0.11.0/jQuery.headroom.min.js"></script><script src="../deps/bootstrap-toc-1.0.1/bootstrap-toc.min.js"></script><script src="../deps/clipboard.js-2.0.11/clipboard.min.js"></script><script src="../deps/search-1.0.0/autocomplete.jquery.min.js"></script><script src="../deps/search-1.0.0/fuse.min.js"></script><script src="../deps/search-1.0.0/mark.min.js"></script><!-- pkgdown --><script src="../pkgdown.js"></script><meta property="og:title" content="Advanced Features">
<meta name="description" content="4. Advanced Features">
<meta property="og:description" content="4. Advanced Features">
<meta property="og:image" content="https://usepa.github.io/EJAM/logo.svg">
</head>
<body>
    <a href="#main" class="visually-hidden-focusable">Skip to contents</a>


    <nav class="navbar navbar-expand-lg fixed-top bg-light" data-bs-theme="light" aria-label="Site navigation"><div class="container">

    <a class="navbar-brand me-2" href="../index.html">EJAM</a>

    <small class="nav-text text-warning me-auto" data-bs-toggle="tooltip" data-bs-placement="bottom" title="Released version">2.32.0</small>


    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div id="navbar" class="collapse navbar-collapse ms-3">
      <ul class="navbar-nav me-auto">
<li class="nav-item"><a class="nav-link" href="../reference/index.html">Reference</a></li>
<li class="active nav-item dropdown">
  <button class="nav-link dropdown-toggle" type="button" id="dropdown-articles" data-bs-toggle="dropdown" aria-expanded="false" aria-haspopup="true">Articles</button>
  <ul class="dropdown-menu" aria-labelledby="dropdown-articles">
<li><hr class="dropdown-divider"></li>
    <li><h6 class="dropdown-header" data-toc-skip>Overview for EJAM Users</h6></li>
    <li><a class="dropdown-item" href="../articles/0_whatis.html">What is EJAM</a></li>
    <li><a class="dropdown-item" href="../articles/0_webapp.html">Using EJAM</a></li>
    <li><hr class="dropdown-divider"></li>
    <li><h6 class="dropdown-header" data-toc-skip>For analysts using R</h6></li>
    <li><a class="dropdown-item" href="../articles/1_installing.html">Installing the EJAM R package</a></li>
    <li><a class="dropdown-item" href="../articles/2_quickstart.html">Quick Start Guide</a></li>
    <li><a class="dropdown-item" href="../articles/3_analyzing.html">Basics of Using EJAM for Analysis in RStudio</a></li>
    <li><a class="dropdown-item" href="../articles/4_advanced.html">Advanced Features</a></li>
  </ul>
</li>
<li class="nav-item"><a class="nav-link" href="../news/index.html">Changelog</a></li>
      </ul>
<ul class="navbar-nav">
<li class="nav-item"><form class="form-inline" role="search">
 <input class="form-control" type="search" name="search-input" id="search-input" autocomplete="off" aria-label="Search site" placeholder="Search for" data-search-index="../search.json">
</form></li>
      </ul>
</div>


  </div>
</nav><div class="container template-article">



<link href="4_advanced_files/htmltools-fill-0.5.8.1/fill.css" rel="stylesheet">
<script src="4_advanced_files/htmlwidgets-1.6.4/htmlwidgets.js"></script><link href="4_advanced_files/leaflet-1.3.1/leaflet.css" rel="stylesheet">
<script src="4_advanced_files/leaflet-1.3.1/leaflet.js"></script><link href="4_advanced_files/leafletfix-1.0.0/leafletfix.css" rel="stylesheet">
<script src="4_advanced_files/proj4-2.6.2/proj4.min.js"></script><script src="4_advanced_files/Proj4Leaflet-1.0.1/proj4leaflet.js"></script><link href="4_advanced_files/rstudio_leaflet-1.3.1/rstudio_leaflet.css" rel="stylesheet">
<script src="4_advanced_files/leaflet-binding-2.2.2/leaflet.js"></script><script src="4_advanced_files/lfx-easyprint-1.0.0/dom-to-image.js"></script><script src="4_advanced_files/lfx-easyprint-1.0.0/FileSaver.js"></script><script src="4_advanced_files/lfx-easyprint-1.0.0/lfx-easyprint_full.js"></script><script src="4_advanced_files/lfx-easyprint-1.0.0/lfx-easyprint-bindings.js"></script><div class="row">
  <main id="main" class="col-md-9"><div class="page-header">
      <img src="../logo.svg" class="logo" alt=""><h1>Advanced Features</h1>
            
      
      <small class="dont-index">Source: <a href="https://github.com/USEPA/EJAM/blob/HEAD/vignettes/4_advanced.Rmd" class="external-link"><code>vignettes/4_advanced.Rmd</code></a></small>
      <div class="d-none name"><code>4_advanced.Rmd</code></div>
    </div>

    
    
<p>Note: This article is a work in progress</p>
<div class="section level3">
<h3 id="examples-of-files-test-data-ejam-can-import-or-output">EXAMPLES OF FILES &amp; TEST DATA EJAM CAN IMPORT OR OUTPUT<a class="anchor" aria-label="anchor" href="#examples-of-files-test-data-ejam-can-import-or-output"></a>
</h3>
<div class="section level4">
<h4 id="sample-spreadsheets-shapefiles-for-trying-the-web-app">Sample spreadsheets &amp; shapefiles for trying the web app<a class="anchor" aria-label="anchor" href="#sample-spreadsheets-shapefiles-for-trying-the-web-app"></a>
</h4>
<p>Examples of .xlsx files and shapefiles are installed locally with
EJAM, as input files you can use to try out EJAM functions or the web
app, or to see what an input file should look like.</p>
<p><strong>Local folders with sample files</strong></p>
<p>The best, simplest way to see all these files is the function called
testdata()</p>
<div class="sourceCode" id="cb1"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span></span>
<span><span class="fu"><a href="../reference/testdata.html">testdata</a></span><span class="op">(</span><span class="op">)</span></span></code></pre></div>
<p>For more details, you might find the following useful, but testdata()
will probably provide what you are looking for.</p>
<p>Another way to see a list of local folders (where EJAM is installed
locally) with files that can be uploaded to the EJAM web app or provided
as inputs to EJAM functions (as examples or for testing):</p>
<div class="sourceCode" id="cb2"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">x</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/list.files.html" class="external-link">list.dirs</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">"testdata/"</span>, package <span class="op">=</span> <span class="st">"EJAM"</span><span class="op">)</span>, recursive <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/cbind.html" class="external-link">cbind</a></span><span class="op">(</span>`Local folders with installed file examples` <span class="op">=</span> <span class="va">x</span>, Subfolder <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/basename.html" class="external-link">basename</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span><span class="op">)</span></span></code></pre></div>
<p>To see a list of the files available locally as installed sample/test
data:</p>
<div class="sourceCode" id="cb3"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="kw">for</span> <span class="op">(</span><span class="va">example_type</span> <span class="kw">in</span> <span class="va">x</span><span class="op">)</span> <span class="op">{</span></span>
<span>    <span class="fu"><a href="https://rdrr.io/r/base/cat.html" class="external-link">cat</a></span><span class="op">(</span><span class="st">"\n"</span>, <span class="fu"><a href="https://rdrr.io/r/base/basename.html" class="external-link">basename</a></span><span class="op">(</span><span class="va">example_type</span><span class="op">)</span>, <span class="st">"\n\n"</span><span class="op">)</span></span>
<span>    <span class="va">these</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/matrix.html" class="external-link">matrix</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/list.files.html" class="external-link">list.files</a></span><span class="op">(</span><span class="va">example_type</span><span class="op">)</span><span class="op">)</span></span>
<span>    <span class="fu"><a href="https://rdrr.io/r/base/colnames.html" class="external-link">colnames</a></span><span class="op">(</span><span class="va">these</span><span class="op">)</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/paste.html" class="external-link">paste0</a></span><span class="op">(</span><span class="st">"Examples Installed in /testdata/"</span>, <span class="fu"><a href="https://rdrr.io/r/base/basename.html" class="external-link">basename</a></span><span class="op">(</span><span class="va">example_type</span><span class="op">)</span>, <span class="st">"/"</span><span class="op">)</span></span>
<span>    <span class="fu"><a href="https://rdrr.io/r/base/print.html" class="external-link">print</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/cbind.html" class="external-link">cbind</a></span><span class="op">(</span><span class="va">these</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="op">}</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;  address </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;      Examples Installed in /testdata/address/</span></span>
<span><span class="co">#&gt; [1,] "street_address_9.xlsx"                 </span></span>
<span><span class="co">#&gt; [2,] "test_address_table.xlsx"               </span></span>
<span><span class="co">#&gt; [3,] "test_address_table_9.xlsx"             </span></span>
<span><span class="co">#&gt; [4,] "test_address_table_goodnames.xlsx"     </span></span>
<span><span class="co">#&gt; [5,] "test_address_table_withfull.xlsx"      </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;  ejscreenapi </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;      Examples Installed in /testdata/ejscreenapi/</span></span>
<span><span class="co">#&gt; [1,] "datafile_apiv2.3_output_example.pjson"     </span></span>
<span><span class="co">#&gt; [2,] "datafile_apiv2.3_output_example_json.R"    </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;  examples_of_output </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;       Examples Installed in /testdata/examples_of_output/    </span></span>
<span><span class="co">#&gt;  [1,] "community_report_100.html"                            </span></span>
<span><span class="co">#&gt;  [2,] "testoutput_doaggregate_1000pts_1miles.xlsx"           </span></span>
<span><span class="co">#&gt;  [3,] "testoutput_doaggregate_1000pts_1miles_ejam2excel.xlsx"</span></span>
<span><span class="co">#&gt;  [4,] "testoutput_doaggregate_100pts_1miles.xlsx"            </span></span>
<span><span class="co">#&gt;  [5,] "testoutput_doaggregate_100pts_1miles_ejam2excel.xlsx" </span></span>
<span><span class="co">#&gt;  [6,] "testoutput_doaggregate_10pts_1miles.xlsx"             </span></span>
<span><span class="co">#&gt;  [7,] "testoutput_doaggregate_10pts_1miles_ejam2excel.xlsx"  </span></span>
<span><span class="co">#&gt;  [8,] "testoutput_ejamit_1000pts_1miles.xlsx"                </span></span>
<span><span class="co">#&gt;  [9,] "testoutput_ejamit_100pts_1miles.xlsx"                 </span></span>
<span><span class="co">#&gt; [10,] "testoutput_ejamit_10pts_1miles.xlsx"                  </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;  fips </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;       Examples Installed in /testdata/fips/</span></span>
<span><span class="co">#&gt;  [1,] "cities_2.xlsx"                      </span></span>
<span><span class="co">#&gt;  [2,] "counties_in_AL_detailed.xlsx"       </span></span>
<span><span class="co">#&gt;  [3,] "counties_in_Alabama.xlsx"           </span></span>
<span><span class="co">#&gt;  [4,] "counties_in_Delaware.xlsx"          </span></span>
<span><span class="co">#&gt;  [5,] "counties_in_Delaware_invalid.xlsx"  </span></span>
<span><span class="co">#&gt;  [6,] "county_10.xlsx"                     </span></span>
<span><span class="co">#&gt;  [7,] "county_100.xlsx"                    </span></span>
<span><span class="co">#&gt;  [8,] "county_1000.xlsx"                   </span></span>
<span><span class="co">#&gt;  [9,] "county_state_300.xlsx"              </span></span>
<span><span class="co">#&gt; [10,] "state_10.xlsx"                      </span></span>
<span><span class="co">#&gt; [11,] "state_50.xlsx"                      </span></span>
<span><span class="co">#&gt; [12,] "state_county_tract_10.xlsx"         </span></span>
<span><span class="co">#&gt; [13,] "tract_10.csv"                       </span></span>
<span><span class="co">#&gt; [14,] "tract_100.csv"                      </span></span>
<span><span class="co">#&gt; [15,] "tract_1000.csv"                     </span></span>
<span><span class="co">#&gt; [16,] "tract_state_285.xlsx"               </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;  latlon </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;       Examples Installed in /testdata/latlon/                          </span></span>
<span><span class="co">#&gt;  [1,] "3points.xlsx"                                                   </span></span>
<span><span class="co">#&gt;  [2,] "testpoints_02.xlsx"                                             </span></span>
<span><span class="co">#&gt;  [3,] "testpoints_10.xlsx"                                             </span></span>
<span><span class="co">#&gt;  [4,] "testpoints_100.xlsx"                                            </span></span>
<span><span class="co">#&gt;  [5,] "testpoints_100_sites_with_signif_violations_NAICS_326_ECHO.xlsx"</span></span>
<span><span class="co">#&gt;  [6,] "testpoints_1000.xlsx"                                           </span></span>
<span><span class="co">#&gt;  [7,] "testpoints_1000_Latitude_LONG.xlsx"                             </span></span>
<span><span class="co">#&gt;  [8,] "testpoints_10000.xlsx"                                          </span></span>
<span><span class="co">#&gt;  [9,] "testpoints_100000.xlsx"                                         </span></span>
<span><span class="co">#&gt; [10,] "testpoints_2.xlsx"                                              </span></span>
<span><span class="co">#&gt; [11,] "testpoints_207_sites_with_signif_violations_NAICS_326_ECHO.csv" </span></span>
<span><span class="co">#&gt; [12,] "testpoints_5.xlsx"                                              </span></span>
<span><span class="co">#&gt; [13,] "testpoints_50.xlsx"                                             </span></span>
<span><span class="co">#&gt; [14,] "testpoints_500.xlsx"                                            </span></span>
<span><span class="co">#&gt; [15,] "testpoints_bad.xlsx"                                            </span></span>
<span><span class="co">#&gt; [16,] "testpoints_invalid_latlon.xlsx"                                 </span></span>
<span><span class="co">#&gt; [17,] "testpoints_invalid_latlon_more_cases.xlsx"                      </span></span>
<span><span class="co">#&gt; [18,] "testpoints_overlap3.xlsx"                                       </span></span>
<span><span class="co">#&gt; [19,] "testpoints_PR_GU_AS_VI_MP.xlsx"                                 </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;  program_type </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;      Examples Installed in /testdata/program_type/</span></span>
<span><span class="co">#&gt; [1,] "program_name_only_3.xlsx"                   </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;  programid </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;      Examples Installed in /testdata/programid/</span></span>
<span><span class="co">#&gt; [1,] "program_test_data_10.csv"                </span></span>
<span><span class="co">#&gt; [2,] "program_test_data_10.xlsx"               </span></span>
<span><span class="co">#&gt; [3,] "program_test_data_100.csv"               </span></span>
<span><span class="co">#&gt; [4,] "program_test_data_1000.csv"              </span></span>
<span><span class="co">#&gt; [5,] "program_test_data_10000.csv"             </span></span>
<span><span class="co">#&gt; [6,] "test_pgm_sys_id_1000.xlsx"               </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;  registryid </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;       Examples Installed in /testdata/registryid/</span></span>
<span><span class="co">#&gt;  [1,] "ECHO_Test_Data"                           </span></span>
<span><span class="co">#&gt;  [2,] "FRS_example_data.CSV"                     </span></span>
<span><span class="co">#&gt;  [3,] "FRS_example_data.xlsx"                    </span></span>
<span><span class="co">#&gt;  [4,] "frs_test_regid_8.xlsx"                    </span></span>
<span><span class="co">#&gt;  [5,] "frs_testpoints_10.csv"                    </span></span>
<span><span class="co">#&gt;  [6,] "frs_testpoints_10.xlsx"                   </span></span>
<span><span class="co">#&gt;  [7,] "frs_testpoints_100.csv"                   </span></span>
<span><span class="co">#&gt;  [8,] "frs_testpoints_100.xlsx"                  </span></span>
<span><span class="co">#&gt;  [9,] "frs_testpoints_1000.csv"                  </span></span>
<span><span class="co">#&gt; [10,] "frs_testpoints_1000.xlsx"                 </span></span>
<span><span class="co">#&gt; [11,] "frs_testpoints_10000.csv"                 </span></span>
<span><span class="co">#&gt; [12,] "frs_testpoints_10000.xlsx"                </span></span>
<span><span class="co">#&gt; [13,] "frs_testpoints_100000.csv"                </span></span>
<span><span class="co">#&gt; [14,] "frs_testpoints_100000.xlsx"               </span></span>
<span><span class="co">#&gt; [15,] "frs_testpoints_3_duplicated_id.xlsx"      </span></span>
<span><span class="co">#&gt; [16,] "testids_registry_id_8.xlsx"               </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;  shapes </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;       Examples Installed in /testdata/shapes/</span></span>
<span><span class="co">#&gt;  [1,] "portland.gdb"                         </span></span>
<span><span class="co">#&gt;  [2,] "portland.gdb.zip"                     </span></span>
<span><span class="co">#&gt;  [3,] "portland.json"                        </span></span>
<span><span class="co">#&gt;  [4,] "portland_folder_shp"                  </span></span>
<span><span class="co">#&gt;  [5,] "portland_folder_shp.zip"              </span></span>
<span><span class="co">#&gt;  [6,] "portland_shp.zip"                     </span></span>
<span><span class="co">#&gt;  [7,] "stations.zip"                         </span></span>
<span><span class="co">#&gt;  [8,] "stations_shp.zip"                     </span></span>
<span><span class="co">#&gt;  [9,] "testshapes_2.zip"</span></span></code></pre></div>
<p>You can try uploading these kinds of files in the web app, for
example, by finding them in these local folders where you installed the
package:</p>
<ul>
<li>/<code>EJAM/testdata/latlon/testpoints_100.xlsx</code>
</li>
<li>/<code>EJAM/testdata/shapes/portland_shp.zip</code>
</li>
<li>etc.</li>
</ul>
<p>To open the locally installed “testdata” folders (in Windows File
Explorer, or MacOS Finder)</p>
<div class="sourceCode" id="cb4"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/utils/browseURL.html" class="external-link">browseURL</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">"testdata"</span>, package <span class="op">=</span> <span class="st">"EJAM"</span><span class="op">)</span><span class="op">)</span></span></code></pre></div>
<p><strong>Example of using a file in EJAM</strong></p>
<div class="sourceCode" id="cb5"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">testpoint_files</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/list.files.html" class="external-link">list.files</a></span><span class="op">(</span></span>
<span>  <span class="fu"><a href="https://rdrr.io/r/base/system.file.html" class="external-link">system.file</a></span><span class="op">(</span><span class="st">"testdata/latlon"</span>, package <span class="op">=</span> <span class="st">"EJAM"</span><span class="op">)</span>, </span>
<span>  full.names <span class="op">=</span> <span class="cn">T</span></span>
<span>  <span class="op">)</span></span>
<span><span class="va">testpoint_files</span></span>
<span></span>
<span><span class="fu"><a href="../reference/latlon_from_anything.html">latlon_from_anything</a></span><span class="op">(</span><span class="va">testpoint_files</span><span class="op">[</span><span class="fl">2</span><span class="op">]</span><span class="op">)</span> </span></code></pre></div>
</div>
<div class="section level4">
<h4 id="sample-r-data-objects-examples-of-inputs-outputs-of-ejam-functions">Sample R data objects: Examples of inputs &amp; outputs of EJAM
functions<a class="anchor" aria-label="anchor" href="#sample-r-data-objects-examples-of-inputs-outputs-of-ejam-functions"></a>
</h4>
<p>The package has a number of data objects, installed as part of EJAM
and related packages, that are examples of inputs or intermediate data
objects that you can use to try out EJAM functions, or you may just want
to see what the outputs and inputs look like, or you could use them for
testing purposes.</p>
<p>For documentation on each input or output item (R object), see <a href="https://usepa.github.io/EJAM/reference/index.html#test-data" class="uri">https://usepa.github.io/EJAM/reference/index.html#test-data</a></p>
<p>This code snippet provides a useful list of test/ sample data objects
in EJAM and related packages:</p>
<p><strong>POINT DATA (LAT/LON COORDINATES)</strong> for testing
ejamit(), mapfast(), ejscreenit(), getblocksnearby(), etc.</p>
<div class="sourceCode" id="cb6"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">x</span> <span class="op">&lt;-</span> <span class="fu">EJAM</span><span class="fu">:::</span><span class="fu"><a href="../reference/datapack.html">datapack</a></span><span class="op">(</span>simple <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span>
<span><span class="va">x</span> <span class="op">&lt;-</span> <span class="va">x</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/order.html" class="external-link">order</a></span><span class="op">(</span><span class="va">x</span><span class="op">$</span><span class="va">Package</span>, <span class="va">x</span><span class="op">$</span><span class="va">Item</span><span class="op">)</span>, <span class="op">!</span><span class="fu"><a href="https://rdrr.io/r/base/grep.html" class="external-link">grepl</a></span><span class="op">(</span><span class="st">"size"</span>, <span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span><span class="op">)</span><span class="op">]</span></span></code></pre></div>
<div class="sourceCode" id="cb7"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">x</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/grep.html" class="external-link">grepl</a></span><span class="op">(</span><span class="st">"^testp"</span>, <span class="va">x</span><span class="op">$</span><span class="va">Item</span><span class="op">)</span>, <span class="op">]</span></span>
<span><span class="co">#&gt;     Package                Item</span></span>
<span><span class="co">#&gt; 102    EJAM       testpoints_10</span></span>
<span><span class="co">#&gt; 124    EJAM      testpoints_100</span></span>
<span><span class="co">#&gt; 122    EJAM   testpoints_100_dt</span></span>
<span><span class="co">#&gt; 127    EJAM     testpoints_1000</span></span>
<span><span class="co">#&gt; 156    EJAM    testpoints_10000</span></span>
<span><span class="co">#&gt; 110    EJAM        testpoints_5</span></span>
<span><span class="co">#&gt; 120    EJAM       testpoints_50</span></span>
<span><span class="co">#&gt; 137    EJAM      testpoints_500</span></span>
<span><span class="co">#&gt; 111    EJAM      testpoints_bad</span></span>
<span><span class="co">#&gt; 103    EJAM testpoints_overlap3</span></span>
<span><span class="co">#&gt;                                                        Title</span></span>
<span><span class="co">#&gt; 102 test points data.frame with columns sitenumber, lat, lon</span></span>
<span><span class="co">#&gt; 124 test points data.frame with columns sitenumber, lat, lon</span></span>
<span><span class="co">#&gt; 122 test points data.frame with columns sitenumber, lat, lon</span></span>
<span><span class="co">#&gt; 127 test points data.frame with columns sitenumber, lat, lon</span></span>
<span><span class="co">#&gt; 156 test points data.frame with columns sitenumber, lat, lon</span></span>
<span><span class="co">#&gt; 110 test points data.frame with columns sitenumber, lat, lon</span></span>
<span><span class="co">#&gt; 120 test points data.frame with columns sitenumber, lat, lon</span></span>
<span><span class="co">#&gt; 137 test points data.frame with columns sitenumber, lat, lon</span></span>
<span><span class="co">#&gt; 111       test points data.frame with columns note, lat, lon</span></span>
<span><span class="co">#&gt; 103       test points data.frame with columns note, lat, lon</span></span></code></pre></div>
<p><strong>STREET ADDRESSES</strong> for testing geocoding in
latlon_from_address() etc.</p>
<div class="sourceCode" id="cb8"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">x</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/grep.html" class="external-link">grepl</a></span><span class="op">(</span><span class="st">"^test_"</span>, <span class="va">x</span><span class="op">$</span><span class="va">Item</span><span class="op">)</span>, <span class="op">]</span></span>
<span><span class="co">#&gt;     Package                         Item</span></span>
<span><span class="co">#&gt; 100    EJAM          test_address_parts1</span></span>
<span><span class="co">#&gt; 107    EJAM           test_address_table</span></span>
<span><span class="co">#&gt; 121    EJAM         test_address_table_9</span></span>
<span><span class="co">#&gt; 108    EJAM test_address_table_goodnames</span></span>
<span><span class="co">#&gt; 109    EJAM  test_address_table_withfull</span></span>
<span><span class="co">#&gt; 101    EJAM             test_addresses_9</span></span>
<span><span class="co">#&gt; 45     EJAM              test_addresses2</span></span>
<span><span class="co">#&gt; 3      EJAM                   test_regid</span></span>
<span><span class="co">#&gt; 4      EJAM                   test_xtrac</span></span>
<span><span class="co">#&gt;                                                                  Title</span></span>
<span><span class="co">#&gt; 100                      datasets for trying address-related functions</span></span>
<span><span class="co">#&gt; 107                      datasets for trying address-related functions</span></span>
<span><span class="co">#&gt; 121                      datasets for trying address-related functions</span></span>
<span><span class="co">#&gt; 108                      datasets for trying address-related functions</span></span>
<span><span class="co">#&gt; 109                      datasets for trying address-related functions</span></span>
<span><span class="co">#&gt; 101                      datasets for trying address-related functions</span></span>
<span><span class="co">#&gt; 45                       datasets for trying address-related functions</span></span>
<span><span class="co">#&gt; 3   test_regid (DATA) test data, vector of EPA FRS Registry ID numbers</span></span>
<span><span class="co">#&gt; 4                                                     for internal use</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/cat.html" class="external-link">cat</a></span><span class="op">(</span><span class="st">"\n\n"</span><span class="op">)</span></span></code></pre></div>
<p><strong>FACILITY REGISTRY IDs</strong> for testing
latlon_from_regid() etc.</p>
<div class="sourceCode" id="cb9"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">x</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/grep.html" class="external-link">grepl</a></span><span class="op">(</span><span class="st">"^test[^op_]"</span>, <span class="va">x</span><span class="op">$</span><span class="va">Item</span><span class="op">)</span>, <span class="op">]</span></span>
<span><span class="co">#&gt;     Package                   Item</span></span>
<span><span class="co">#&gt; 9      EJAM testids_program_sys_id</span></span>
<span><span class="co">#&gt; 5      EJAM    testids_registry_id</span></span>
<span><span class="co">#&gt; 126    EJAM           testshapes_2</span></span>
<span><span class="co">#&gt;                                                             Title</span></span>
<span><span class="co">#&gt; 9   test data, string vector of EPA FRS Program System ID numbers</span></span>
<span><span class="co">#&gt; 5                test data, vector of EPA FRS Registry ID numbers</span></span>
<span><span class="co">#&gt; 126                                          testshapes_2 dataset</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/cat.html" class="external-link">cat</a></span><span class="op">(</span><span class="st">"\n\n"</span><span class="op">)</span></span></code></pre></div>
<p><strong>EXAMPLES OF OUTPUTS</strong> from ejamit(), ejscreenit(),
getblocksnearby(), etc., you can use as inputs to ejam2report(),
ejam2excel(), ejam2ratios(), ejam2barplot(), doaggregate(), etc.</p>
<div class="sourceCode" id="cb10"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">x</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/grep.html" class="external-link">grepl</a></span><span class="op">(</span><span class="st">"^testout"</span>, <span class="va">x</span><span class="op">$</span><span class="va">Item</span><span class="op">)</span>, <span class="op">]</span></span>
<span><span class="co">#&gt;     Package                                      Item</span></span>
<span><span class="co">#&gt; 165    EJAM     testoutput_doaggregate_1000pts_1miles</span></span>
<span><span class="co">#&gt; 157    EJAM      testoutput_doaggregate_100pts_1miles</span></span>
<span><span class="co">#&gt; 148    EJAM       testoutput_doaggregate_10pts_1miles</span></span>
<span><span class="co">#&gt; 166    EJAM          testoutput_ejamit_1000pts_1miles</span></span>
<span><span class="co">#&gt; 158    EJAM           testoutput_ejamit_100pts_1miles</span></span>
<span><span class="co">#&gt; 151    EJAM            testoutput_ejamit_10pts_1miles</span></span>
<span><span class="co">#&gt; 134    EJAM        testoutput_ejscreenapi_1pts_1miles</span></span>
<span><span class="co">#&gt; 140    EJAM             testoutput_ejscreenapi_plus_5</span></span>
<span><span class="co">#&gt; 146    EJAM        testoutput_ejscreenit_10pts_1miles</span></span>
<span><span class="co">#&gt; 144    EJAM                   testoutput_ejscreenit_5</span></span>
<span><span class="co">#&gt; 152    EJAM                  testoutput_ejscreenit_50</span></span>
<span><span class="co">#&gt; 162    EJAM                 testoutput_ejscreenit_500</span></span>
<span><span class="co">#&gt; 129    EJAM testoutput_ejscreenRESTbroker_1pts_1miles</span></span>
<span><span class="co">#&gt; 161    EJAM testoutput_getblocksnearby_1000pts_1miles</span></span>
<span><span class="co">#&gt; 149    EJAM  testoutput_getblocksnearby_100pts_1miles</span></span>
<span><span class="co">#&gt; 139    EJAM   testoutput_getblocksnearby_10pts_1miles</span></span>
<span><span class="co">#&gt;                                                                                     Title</span></span>
<span><span class="co">#&gt; 165                                                          test output of doaggregate()</span></span>
<span><span class="co">#&gt; 157                                                          test output of doaggregate()</span></span>
<span><span class="co">#&gt; 148                                                          test output of doaggregate()</span></span>
<span><span class="co">#&gt; 166                                                               test output of ejamit()</span></span>
<span><span class="co">#&gt; 158                                                               test output of ejamit()</span></span>
<span><span class="co">#&gt; 151                                                               test output of ejamit()</span></span>
<span><span class="co">#&gt; 134                                                  test data, output from this function</span></span>
<span><span class="co">#&gt; 140 test data examples of output from 'ejscreenapi_plus()' using testpoints_5, radius = 1</span></span>
<span><span class="co">#&gt; 146                                   test output of ejscreenit(), using the EJScreen API</span></span>
<span><span class="co">#&gt; 144       test data examples of output from 'ejscreenit()' using testpoints_5, radius = 1</span></span>
<span><span class="co">#&gt; 152      test data examples of output from 'ejscreenit()' using testpoints_50, radius = 1</span></span>
<span><span class="co">#&gt; 162     test data examples of output from 'ejscreenit()' using testpoints_500, radius = 1</span></span>
<span><span class="co">#&gt; 129                                                  test data, output from this function</span></span>
<span><span class="co">#&gt; 161                    test output of getblocksnearby(), and is an input to doaggregate()</span></span>
<span><span class="co">#&gt; 149                    test output of getblocksnearby(), and is an input to doaggregate()</span></span>
<span><span class="co">#&gt; 139                    test output of getblocksnearby(), and is an input to doaggregate()</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/cat.html" class="external-link">cat</a></span><span class="op">(</span><span class="st">"\n\n"</span><span class="op">)</span></span></code></pre></div>
<p><strong>LARGE DATASETS USED BY THE PACKAGE</strong></p>
<p>Note that the largest files used by the package are mostly the
block-related datasets with info about population size and location of
US blocks, the facility datasets with info about EPA-regulated sites,
and the blockgroup-related datasets with EJScreen indicators.</p>
<p>Some datasets get downloaded by the package at installation or launch
or as needed. Datasets may include for example: [blockwts],
[blockpoints], [quaddata], [blockid2fips], [frs], [frs_by_programid],
[frs_by_naics], [frs_by_sic], and [frs_by_mact].</p>
<p>Blockgroup-related datasets incude [blockgroupstats], [bgpts],
[bgej], [usastats], [statestats], [bgid2fips], and [bg_cenpop2020]. For
more info see <a href="https://usepa.github.io/EJAM/reference/index.html#datasets-with-indicators-etc-" class="uri">https://usepa.github.io/EJAM/reference/index.html#datasets-with-indicators-etc-</a></p>
<hr>
</div>
</div>
<div class="section level2">
<h2 id="using-naics-and-sic-codes-to-locate-facilities-by-industry">USING NAICS AND SIC CODES TO LOCATE FACILITIES BY INDUSTRY<a class="anchor" aria-label="anchor" href="#using-naics-and-sic-codes-to-locate-facilities-by-industry"></a>
</h2>
<p>EJAM helps select regulated sites based on industrial classification,
using NAICS or SIC code. Finding the right NAICS and finding all the
right sites by NAICS is complicated. Doing so requires understanding the
NAICS system and the FRS dataset, and the functions in EJAM that help
find or use NAICS codes.</p>
<p>NAICS/SIC categories can be explored in a few ways: - <a href="https://www.naics.com" class="external-link">NAICS.com website</a> with extensive
information <a href="https://www.naics.com/everything-naics/" class="external-link">about
NAICS</a> and <a href="https://www.naics.com/everything-sic/" class="external-link">SIC</a> -
<a href="https://usepa.github.io/EJAM/reference/index.html#specify-facility-type">Key
EJAM functions for using NAICS/SIC</a> - EPA <a href="https://www.epa.gov/frs/frs-query#industrial" class="external-link">FRS Facility
Industrial Classification Search tool</a> where you can find facilities
based on NAICS or SIC. - EPA APIs exist that can be used for similar
queries.</p>
<p>Some key EJAM functions include [regid_from_naics()],
[latlon_from_naics()], [frs_from_naics()], [naics_findwebscrape()], and
[naics_categories()]. These functions can help find EPA FRS sites based
on naics codes or titles. They rely on [frs_by_naics] (a data.table),
and [naics_from_any()] for querying by code or title of category.</p>
<p>Important points:</p>
<ul>
<li><p>Note that a very large fraction of all FRS sites (as obtained for
use in EJAM) lack NAICS code!</p></li>
<li><p>Note that EJAM may query FRS sites differently than the FRS
search tool or other query tools would.</p></li>
<li><p>Note that NAICS.com reports many more businesses for a given
6-digit category than the FRS shows, which might be due to FRS only
including EPA-regulated sites but also due to data gaps.</p></li>
<li><p>Note the difference between children = TRUE and children = FALSE
in EJAM functions like latlon_from_naics()</p></li>
<li><p>Note that searching on a 6-digit code misses parent categories
you may want. The FRS data on NAICS by site is inconsistent in how many
digits are reported for the NAICS (explained below).</p></li>
</ul>
<p>A given site might be listed in the FRS as being under one or more
NAICS codes of various lengths, such as only a parent code (large
grouping), only a detailed code (6-digit), or some combination of codes
and their subcategories.</p>
<p>And the same title, like “Petroleum Refineries,” may be assigned by
the NAICS system to the category but also a subcategory, as with codes
32411 and 324110. The function [naics_from_any()] shows what codes and
title exist in the NAICS system.</p>
<p>Also, certain terms appear in the online description of a NAICS but
not in the title of the NAICS – the function [naics_findwebscrape()]
helps with those cases, e.g., compare these:</p>
<div class="sourceCode" id="cb11"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/naics_findwebscrape.html">naics_findwebscrape</a></span><span class="op">(</span><span class="st">"cement"</span><span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="st">"cement"</span><span class="op">)</span></span></code></pre></div>
<p>Compare also these:</p>
<div class="sourceCode" id="cb12"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/naics_findwebscrape.html">naics_findwebscrape</a></span><span class="op">(</span><span class="st">"refiner"</span><span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="st">"refiner"</span><span class="op">)</span></span></code></pre></div>
<p><code>naics_findwebscrape("refiner")</code> reports “324110”
(Petroleum Refineries) and other related industries, but not the 5-digit
“32411” (also Petroleum Refineries).</p>
<p><code>naics_from_any("refiner")</code> reports “324110” and “32411”
but not other related industries.</p>
<p>Using <code><a href="../reference/naics_findwebscrape.html">naics_findwebscrape()</a></code> finds only the 6-digit codes
that match on title or description, so it would find some codes not
found by [naics_from_any()] which does not query description, but could
lead to missing some facilities in the sense that the 6-digit code does
not cover the sites listed in FRS under only the 5-digit code for
Petroleum Refineries (not the 6-digit).</p>
<p>It is important to note that searching on a 6-digit code misses
parent categories that may include sites you expect to find:</p>
<p><code>frs_from_naics("324110", children = F)[,1:5]</code> finds a few
hundred sites, but it fails to find some sites you would find using
<code>frs_from_naics("32411", children = F)[,1:5]</code></p>
<p>The code example below shows that the FRS dataset has some facilities
listed under the 5-digit “32411” code only, some with the 6-digit
“324110” code only, and some with both codes:</p>
<div class="sourceCode" id="cb13"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">hasboth</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/sets.html" class="external-link">intersect</a></span><span class="op">(</span></span>
<span>  <span class="fu"><a href="../reference/frs_from_naics.html">frs_from_naics</a></span><span class="op">(</span><span class="st">"32411"</span>,  children <span class="op">=</span> <span class="cn">F</span><span class="op">)</span><span class="op">[</span>,<span class="fl">1</span><span class="op">:</span><span class="fl">5</span><span class="op">]</span><span class="op">$</span><span class="va">REGISTRY_ID</span>, </span>
<span>  <span class="fu"><a href="../reference/frs_from_naics.html">frs_from_naics</a></span><span class="op">(</span><span class="st">"324110"</span>, children <span class="op">=</span> <span class="cn">F</span><span class="op">)</span><span class="op">[</span>,<span class="fl">1</span><span class="op">:</span><span class="fl">5</span><span class="op">]</span><span class="op">$</span><span class="va">REGISTRY_ID</span></span>
<span>  <span class="op">)</span></span>
<span><span class="va">hasonly6digit</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/sets.html" class="external-link">setdiff</a></span><span class="op">(</span></span>
<span>  <span class="fu"><a href="../reference/frs_from_naics.html">frs_from_naics</a></span><span class="op">(</span><span class="st">"32411"</span>,  children <span class="op">=</span> <span class="cn">F</span><span class="op">)</span><span class="op">[</span>,<span class="fl">1</span><span class="op">:</span><span class="fl">5</span><span class="op">]</span><span class="op">$</span><span class="va">REGISTRY_ID</span>, </span>
<span>  <span class="fu"><a href="../reference/frs_from_naics.html">frs_from_naics</a></span><span class="op">(</span><span class="st">"324110"</span>, children <span class="op">=</span> <span class="cn">F</span><span class="op">)</span><span class="op">[</span>,<span class="fl">1</span><span class="op">:</span><span class="fl">5</span><span class="op">]</span><span class="op">$</span><span class="va">REGISTRY_ID</span></span>
<span>  <span class="op">)</span></span>
<span><span class="va">hasonly5digit</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/sets.html" class="external-link">setdiff</a></span><span class="op">(</span></span>
<span>  <span class="fu"><a href="../reference/frs_from_naics.html">frs_from_naics</a></span><span class="op">(</span><span class="st">"324110"</span>, children <span class="op">=</span> <span class="cn">F</span><span class="op">)</span><span class="op">[</span>,<span class="fl">1</span><span class="op">:</span><span class="fl">5</span><span class="op">]</span><span class="op">$</span><span class="va">REGISTRY_ID</span>, </span>
<span>  <span class="fu"><a href="../reference/frs_from_naics.html">frs_from_naics</a></span><span class="op">(</span><span class="st">"32411"</span>,  children <span class="op">=</span> <span class="cn">F</span><span class="op">)</span><span class="op">[</span>,<span class="fl">1</span><span class="op">:</span><span class="fl">5</span><span class="op">]</span><span class="op">$</span><span class="va">REGISTRY_ID</span></span>
<span>  <span class="op">)</span></span>
<span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/length.html" class="external-link">length</a></span><span class="op">(</span><span class="va">hasonly5digit</span><span class="op">)</span>  <span class="co"># Most of the FRS sites here</span></span>
<span><span class="co">#&gt; [1] 362</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/length.html" class="external-link">length</a></span><span class="op">(</span><span class="va">hasonly6digit</span><span class="op">)</span></span>
<span><span class="co">#&gt; [1] 12</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/length.html" class="external-link">length</a></span><span class="op">(</span><span class="va">hasboth</span><span class="op">)</span></span>
<span><span class="co">#&gt; [1] 12</span></span></code></pre></div>
<div class="section level3">
<h3 id="examples-of-some-naicssic-functions">Examples of some NAICS/SIC functions<a class="anchor" aria-label="anchor" href="#examples-of-some-naicssic-functions"></a>
</h3>
<div class="sourceCode" id="cb14"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span>  <span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="fu"><a href="../reference/naics_categories.html">naics_categories</a></span><span class="op">(</span><span class="fl">3</span><span class="op">)</span><span class="op">)</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/order.html" class="external-link">order</a></span><span class="op">(</span><span class="va">name</span><span class="op">)</span>,<span class="fu">.</span><span class="op">(</span><span class="va">name</span>,<span class="va">code</span><span class="op">)</span><span class="op">]</span><span class="op">[</span><span class="fl">1</span><span class="op">:</span><span class="fl">10</span>,<span class="op">]</span></span>
<span>  <span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="fu"><a href="../reference/naics_categories.html">naics_categories</a></span><span class="op">(</span><span class="fl">3</span><span class="op">)</span><span class="op">)</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/order.html" class="external-link">order</a></span><span class="op">(</span><span class="va">code</span><span class="op">)</span>,<span class="fu">.</span><span class="op">(</span><span class="va">code</span>,<span class="va">name</span><span class="op">)</span><span class="op">]</span><span class="op">[</span><span class="fl">1</span><span class="op">:</span><span class="fl">10</span>,<span class="op">]</span></span>
<span>  </span>
<span>  <span class="fu"><a href="../reference/naics_from_code.html">naics_from_code</a></span><span class="op">(</span><span class="fl">211</span><span class="op">)</span></span>
<span>  <span class="va">naicstable</span><span class="op">[</span><span class="va">code</span><span class="op">==</span><span class="fl">211</span>,<span class="op">]</span></span>
<span>  <span class="fu"><a href="../reference/naics_subcodes_from_code.html">naics_subcodes_from_code</a></span><span class="op">(</span><span class="fl">211</span><span class="op">)</span></span>
<span>  <span class="fu"><a href="../reference/naics_from_code.html">naics_from_code</a></span><span class="op">(</span><span class="fl">211</span>,  children <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span>
<span>  <span class="va">naicstable</span><span class="op">[</span><span class="va">n3</span><span class="op">==</span><span class="fl">211</span>,<span class="op">]</span></span>
<span>  <span class="va">NAICS</span><span class="op">[</span><span class="fl">211</span><span class="op">]</span><span class="op">[</span><span class="fl">1</span><span class="op">:</span><span class="fl">3</span><span class="op">]</span> <span class="co"># wrong</span></span>
<span>  <span class="va">NAICS</span><span class="op">[</span><span class="va">NAICS</span> <span class="op">==</span> <span class="fl">211</span><span class="op">]</span></span>
<span>  <span class="va">NAICS</span><span class="op">[</span><span class="st">"211 - Oil and Gas Extraction"</span><span class="op">]</span></span>
<span></span>
<span> <span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="st">"plastics and rubber"</span><span class="op">)</span><span class="op">[</span>,<span class="fu">.</span><span class="op">(</span><span class="va">name</span>,<span class="va">code</span><span class="op">)</span><span class="op">]</span></span>
<span> <span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="fl">326</span><span class="op">)</span></span>
<span> <span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="fl">326</span>, children <span class="op">=</span> <span class="cn">T</span><span class="op">)</span><span class="op">[</span>,<span class="fu">.</span><span class="op">(</span><span class="va">code</span>,<span class="va">name</span><span class="op">)</span><span class="op">]</span></span>
<span> <span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="st">"plastics"</span>, children<span class="op">=</span><span class="cn">T</span><span class="op">)</span><span class="op">[</span>,<span class="fu"><a href="https://rdrr.io/r/base/unique.html" class="external-link">unique</a></span><span class="op">(</span><span class="va">n3</span><span class="op">)</span><span class="op">]</span></span>
<span> <span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="st">"pig"</span><span class="op">)</span></span>
<span> <span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="st">"pig "</span><span class="op">)</span> <span class="co"># space after g</span></span>
<span></span>
<span> <span class="co"># naics_from_any("copper smelting")</span></span>
<span> <span class="co"># naics_from_any("copper smelting", website_scrape=TRUE)</span></span>
<span> <span class="co"># browseURL(naics_from_any("copper smelting", website_url=TRUE) )</span></span>
<span></span>
<span> <span class="va">a</span> <span class="op">=</span> <span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="st">"plastics"</span><span class="op">)</span></span>
<span> <span class="va">b</span> <span class="op">=</span> <span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="st">"rubber"</span><span class="op">)</span></span>
<span> <span class="fu"><a href="https://rdrr.io/pkg/data.table/man/setops.html" class="external-link">fintersect</a></span><span class="op">(</span><span class="va">a</span>,<span class="va">b</span><span class="op">)</span><span class="op">[</span>,<span class="fu">.</span><span class="op">(</span><span class="va">name</span>,<span class="va">code</span><span class="op">)</span><span class="op">]</span> <span class="co">#  a AND b</span></span>
<span> <span class="fu"><a href="https://rdrr.io/pkg/data.table/man/setops.html" class="external-link">funion</a></span><span class="op">(</span><span class="va">a</span>,<span class="va">b</span><span class="op">)</span><span class="op">[</span>,<span class="fu">.</span><span class="op">(</span><span class="va">name</span>,<span class="va">code</span><span class="op">)</span><span class="op">]</span>     <span class="co">#  a OR  b</span></span>
<span> <span class="fu"><a href="../reference/naics_subcodes_from_code.html">naics_subcodes_from_code</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/pkg/data.table/man/setops.html" class="external-link">funion</a></span><span class="op">(</span><span class="va">a</span>,<span class="va">b</span><span class="op">)</span><span class="op">[</span>,<span class="va">code</span><span class="op">]</span><span class="op">)</span><span class="op">[</span>,<span class="fu">.</span><span class="op">(</span><span class="va">name</span>,<span class="va">code</span><span class="op">)</span><span class="op">]</span>   <span class="co">#  plus children</span></span>
<span> <span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/pkg/data.table/man/setops.html" class="external-link">funion</a></span><span class="op">(</span><span class="va">a</span>,<span class="va">b</span><span class="op">)</span><span class="op">[</span>,<span class="va">code</span><span class="op">]</span>, children<span class="op">=</span><span class="cn">T</span><span class="op">)</span><span class="op">[</span>,<span class="fu">.</span><span class="op">(</span><span class="va">name</span>,<span class="va">code</span><span class="op">)</span><span class="op">]</span> <span class="co">#  same</span></span>
<span></span>
<span> <span class="fu"><a href="https://rdrr.io/r/base/nrow.html" class="external-link">NROW</a></span><span class="op">(</span><span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="fl">325</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="co">#[1] 1</span></span>
<span> <span class="fu"><a href="https://rdrr.io/r/base/nrow.html" class="external-link">NROW</a></span><span class="op">(</span><span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="fl">325</span>, children <span class="op">=</span> <span class="cn">T</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="co">#[1] 54</span></span>
<span> <span class="fu"><a href="https://rdrr.io/r/base/nrow.html" class="external-link">NROW</a></span><span class="op">(</span><span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="st">"chem"</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="co">#[1] 20</span></span>
<span> <span class="fu"><a href="https://rdrr.io/r/base/nrow.html" class="external-link">NROW</a></span><span class="op">(</span><span class="fu"><a href="../reference/naics_from_any.html">naics_from_any</a></span><span class="op">(</span><span class="st">"chem"</span>, children <span class="op">=</span> <span class="cn">T</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="co"># [1] 104</span></span></code></pre></div>
<hr>
</div>
</div>
<div class="section level2">
<h2 id="how-to-analyze-proximity-using-ejam">HOW TO ANALYZE PROXIMITY USING EJAM<a class="anchor" aria-label="anchor" href="#how-to-analyze-proximity-using-ejam"></a>
</h2>
<p>An outline of how to use key functions is provided below. After these
examples is a discussion of background information and considerations in
selecting radius.</p>
<div class="section level3">
<h3 id="demographics-by-distance-at-block-group-resolution">DEMOGRAPHICS BY DISTANCE AT BLOCK GROUP RESOLUTION<a class="anchor" aria-label="anchor" href="#demographics-by-distance-at-block-group-resolution"></a>
</h3>
<p>It is easiest to analyze distance increments based on each
blockgroup’s average resident here. Block resolution is covered in a
later section.</p>
<div class="section level4">
<h4 id="within-one-radius">WITHIN ONE RADIUS<a class="anchor" aria-label="anchor" href="#within-one-radius"></a>
</h4>
<div class="section level5">
<h5 id="overall-list-of-sites">Overall list of sites<a class="anchor" aria-label="anchor" href="#overall-list-of-sites"></a>
</h5>
<p>At the <em>OVERALL LIST of sites</em> as a whole, which groups are
<em>overrepresented</em> within X mile radius vs Statewide?</p>
<div class="sourceCode" id="cb15"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">out</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/ejamit.html">ejamit</a></span><span class="op">(</span><span class="va">testpoints_100</span>, radius <span class="op">=</span> <span class="fl">3.1</span><span class="op">)</span></span></code></pre></div>
<div class="sourceCode" id="cb16"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/ejam2ratios.html">ejam2ratios</a></span><span class="op">(</span><span class="va">out</span><span class="op">)</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; Average Resident in Place(s) Analyzed vs US or State</span></span>
<span><span class="co">#&gt;                       Ratio_to_US_avg Ratio_to_State_avg</span></span>
<span><span class="co">#&gt; Demog.Ind.                        1.2                1.2</span></span>
<span><span class="co">#&gt; Suppl Demog.Ind.                  1.0                1.1</span></span>
<span><span class="co">#&gt; %Low-inc.                         1.0                1.1</span></span>
<span><span class="co">#&gt; %Limited English                  1.8                1.4</span></span>
<span><span class="co">#&gt; %Unemployed                       1.2                1.1</span></span>
<span><span class="co">#&gt; %&lt; High School                    1.2                1.2</span></span>
<span><span class="co">#&gt; %&lt; age 5                          1.1                1.1</span></span>
<span><span class="co">#&gt; %&gt; age 64                         0.9                0.9</span></span>
<span><span class="co">#&gt; %POC                              1.5                1.3</span></span>
<span><span class="co">#&gt; %Hispanic                         1.6                1.3</span></span>
<span><span class="co">#&gt; %Black NHA                        1.2                1.5</span></span>
<span><span class="co">#&gt; %Asian NHA                        2.1                1.3</span></span>
<span><span class="co">#&gt; %AmerIndian/AK NHA                0.4                0.8</span></span>
<span><span class="co">#&gt; %Hawaiian/PI NHA                  0.9                1.2</span></span>
<span><span class="co">#&gt; %Other race NHA                   1.6                1.2</span></span>
<span><span class="co">#&gt; %multirace NH                     1.0                1.0</span></span>
<span><span class="co">#&gt; %White NHA                        0.7                0.8</span></span>
<span><span class="co">#&gt; PM2.5                             1.1                1.0</span></span>
<span><span class="co">#&gt; Ozone                             1.1                1.0</span></span>
<span><span class="co">#&gt; NO2                               1.6                1.3</span></span>
<span><span class="co">#&gt; Diesel PM                         2.2                1.6</span></span>
<span><span class="co">#&gt; Toxic Releases to Air             0.5                1.2</span></span>
<span><span class="co">#&gt; Traffic                           2.5                1.6</span></span>
<span><span class="co">#&gt; %pre-1960                         1.7                1.2</span></span>
<span><span class="co">#&gt; NPL                               2.8                1.5</span></span>
<span><span class="co">#&gt; RMP                               1.2                1.3</span></span>
<span><span class="co">#&gt; TSDF                              3.6                1.9</span></span>
<span><span class="co">#&gt; UST                               3.2                2.0</span></span>
<span><span class="co">#&gt; NPDES                             0.0                0.7</span></span>
<span><span class="co">#&gt; Drinking                          1.8                1.6</span></span></code></pre></div>
<div class="sourceCode" id="cb17"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/ejam2barplot.html">ejam2barplot</a></span><span class="op">(</span><span class="va">out</span><span class="op">)</span></span></code></pre></div>
<div class="figure">
<img src="4_advanced_files/figure-html/barplot-1.png" alt="Example of ejam2barplot() showing percent Asian among residents within 5 km of these 100 sites is more than two times the US rate overall" width="672"><p class="caption">
Example of ejam2barplot() showing percent Asian among residents within 5
km of these 100 sites is more than two times the US rate overall
</p>
</div>
</div>
<div class="section level5">
<h5 id="just-one-site">Just one site<a class="anchor" aria-label="anchor" href="#just-one-site"></a>
</h5>
<p>At <em>JUST ONE SITE</em>, which groups are <em>overrepresented</em>
within X mile radius vs Statewide?</p>
<div class="sourceCode" id="cb18"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">out1</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/ejamit.html">ejamit</a></span><span class="op">(</span><span class="va">testpoints_100</span><span class="op">[</span><span class="fl">2</span>, <span class="op">]</span>, radius <span class="op">=</span> <span class="fl">3.1</span><span class="op">)</span></span>
<span><span class="fu"><a href="../reference/ejam2ratios.html">ejam2ratios</a></span><span class="op">(</span><span class="va">out1</span><span class="op">)</span></span></code></pre></div>
<div class="sourceCode" id="cb19"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/ejam2barplot.html">ejam2barplot</a></span><span class="op">(</span><span class="va">out1</span><span class="op">)</span></span></code></pre></div>
<div class="figure">
<img src="4_advanced_files/figure-html/onesiteyy-1.png" alt="Example of ejam2barplot() showing percent non-Hispanic White Alone among residents within 5 km of this one site is about 1.6 times the US rate overall" width="672"><p class="caption">
Example of ejam2barplot() showing percent non-Hispanic White Alone among
residents within 5 km of this one site is about 1.6 times the US rate
overall
</p>
</div>
</div>
<div class="section level5">
<h5 id="site-by-site-comparison">Site by site comparison<a class="anchor" aria-label="anchor" href="#site-by-site-comparison"></a>
</h5>
<p>Which groups are <em>overrepresented</em> at <em>EACH SITE</em>,
within X mile radius vs Statewide</p>
<div class="sourceCode" id="cb20"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">out</span> <span class="op">&lt;-</span> <span class="va">testoutput_ejamit_10pts_1miles</span></span>
<span><span class="va">x</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/Round.html" class="external-link">round</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span><span class="va">out</span><span class="op">$</span><span class="va">results_bysite</span><span class="op">)</span><span class="op">[</span>, <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"ratio.to.state.avg.pctlowinc"</span>, <span class="st">"ratio.to.state.avg.pctmin"</span><span class="op">)</span><span class="op">]</span>, <span class="fl">2</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span> <span class="op">=</span> <span class="fu"><a href="../reference/fixcolnames.html">fixcolnames</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>,<span class="st">"r"</span>,<span class="st">"shortlabel"</span><span class="op">)</span></span>
<span><span class="va">x</span> <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>sitenumber <span class="op">=</span> <span class="fl">1</span><span class="op">:</span><span class="fu"><a href="https://rdrr.io/r/base/nrow.html" class="external-link">NROW</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>, <span class="va">x</span><span class="op">)</span></span>
<span><span class="va">x</span></span>
<span><span class="co">#&gt;    sitenumber Ratio.to.State.avg..Low.inc. Ratio.to.State.avg..POC</span></span>
<span><span class="co">#&gt; 1           1                         0.97                    0.54</span></span>
<span><span class="co">#&gt; 2           2                         1.08                    0.99</span></span>
<span><span class="co">#&gt; 3           3                         0.57                    0.44</span></span>
<span><span class="co">#&gt; 4           4                         0.33                    0.72</span></span>
<span><span class="co">#&gt; 5           5                         2.12                    1.59</span></span>
<span><span class="co">#&gt; 6           6                         2.22                    1.76</span></span>
<span><span class="co">#&gt; 7           7                         0.97                    1.35</span></span>
<span><span class="co">#&gt; 8           8                         0.68                    0.87</span></span>
<span><span class="co">#&gt; 9           9                         1.08                    1.12</span></span>
<span><span class="co">#&gt; 10         10                         0.27                    0.44</span></span></code></pre></div>
<p>Plot to compare sites, for just one demographic indicator</p>
<p>This plot shows that % low income among residents at sites 5 and 6 is
more than twice the relevant State average. It is near average at
several other sites, and is less than half the State average at sites 4
and 10.</p>
<div class="sourceCode" id="cb21"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/ejam2barplot_sites.html">ejam2barplot_sites</a></span><span class="op">(</span><span class="va">out</span>, <span class="st">"ratio.to.state.avg.pctlowinc"</span>, topn <span class="op">=</span> <span class="fl">10</span>, sortby <span class="op">=</span> <span class="cn">F</span><span class="op">)</span></span></code></pre></div>
<div class="figure">
<img src="4_advanced_files/figure-html/ejam2barplot_sites10-1.png" alt="Example of ejam2barplot_sites() showing to state average percent low income, one bar per site, where sites 5 and 6 have ratios above 2" width="672"><p class="caption">
Example of ejam2barplot_sites()
</p>
</div>
<div class="sourceCode" id="cb22"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span></span>
<span><span class="co">## For raw values at key sites:</span></span>
<span><span class="co"># ejam2barplot_sites(out, "pctlowinc")</span></span></code></pre></div>
</div>
</div>
<div class="section level4">
<h4 id="within-multiple-distances---comparing-radius-choices">WITHIN MULTIPLE DISTANCES - COMPARING RADIUS CHOICES<a class="anchor" aria-label="anchor" href="#within-multiple-distances---comparing-radius-choices"></a>
</h4>
<div class="section level5">
<h5 id="overall-list-of-sites-1">Overall list of sites<a class="anchor" aria-label="anchor" href="#overall-list-of-sites-1"></a>
</h5>
<p>At the <em>OVERALL LIST of sites</em> as a whole, which groups are
<em>overrepresented</em> within X mile radius vs Statewide?</p>
<div class="sourceCode" id="cb23"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">radii</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">1</span>,<span class="fl">2</span>,<span class="fl">3</span>,<span class="fl">10</span><span class="op">)</span></span>
<span><span class="co">#radii &lt;- c(1, 10) #  quicker example</span></span>
<span><span class="va">pts</span> <span class="op">&lt;-</span> <span class="va">testpoints_100</span><span class="op">[</span><span class="fl">10</span><span class="op">:</span><span class="fl">12</span>, <span class="op">]</span></span></code></pre></div>
<p>See just the table</p>
<div class="sourceCode" id="cb24"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">x</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/ejamit_compare_distances.html">ejamit_compare_distances</a></span><span class="op">(</span><span class="va">pts</span>, radii <span class="op">=</span> <span class="va">radii</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span>, plot <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span></code></pre></div>
<pre><code><span><span class="co">#&gt; Analyzing 3 points, radius of 1 miles around each.</span></span>
<span><span class="co">#&gt; Analyzing 3 points, radius of 2 miles around each.</span></span>
<span><span class="co">#&gt; Analyzing 3 points, radius of 3 miles around each.</span></span>
<span><span class="co">#&gt; Analyzing 3 points, radius of 10 miles around each.</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;                                         1   2   3  10</span></span>
<span><span class="co">#&gt; Ratio to State avg %Hispanic          2.5 2.3 2.3 1.8</span></span>
<span><span class="co">#&gt; Ratio to State avg %Black NHA         0.4 0.2 0.2 1.2</span></span>
<span><span class="co">#&gt; Ratio to State avg %Asian NHA         0.1 0.4 0.5 1.0</span></span>
<span><span class="co">#&gt; Ratio to State avg %AmerIndian/AK NHA 0.3 0.2 0.2 0.5</span></span>
<span><span class="co">#&gt; Ratio to State avg %Hawaiian/PI NHA   0.0 0.0 0.1 0.6</span></span>
<span><span class="co">#&gt; Ratio to State avg %Other race NHA    0.7 1.1 0.7 0.8</span></span>
<span><span class="co">#&gt; Ratio to State avg %multirace NH      0.1 0.1 0.1 0.4</span></span>
<span><span class="co">#&gt; Ratio to State avg %White NHA         0.2 0.3 0.2 0.3</span></span></code></pre>
<p>See the plot</p>
<div class="sourceCode" id="cb26"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># x &lt;- ejamit_compare_distances(pts, radii = radii, quiet = TRUE) # in which default is plot=TRUE</span></span>
<span><span class="co"># or </span></span>
<span><span class="fu"><a href="../reference/ejamit_compare_distances2plot.html">ejamit_compare_distances2plot</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; Indicators that increase the most as you get closer:</span></span></code></pre></div>
<div class="figure">
<img src="4_advanced_files/figure-html/ejamit_compare_distances2plot-1.png" alt="Example of using ejamit_compare_distances2plot() with distance on x axis and ratio to state average on y axis, with one line for each demographic group such as ratio to state average percent Hispanic, showing the indicator that increases the most as you get closer to site is Ratio to State avg % Hispanic" width="672"><p class="caption">
Example of using ejamit_compare_distances2plot()
</p>
</div>
<pre><code><span><span class="co">#&gt; [1] "Ratio to State avg % Hispanic or Latino"</span></span></code></pre>
<hr>
</div>
</div>
</div>
<div class="section level3">
<h3 id="demographics-at-block-group-resolution">DEMOGRAPHICS AT BLOCK GROUP RESOLUTION<a class="anchor" aria-label="anchor" href="#demographics-at-block-group-resolution"></a>
</h3>
<p>Most of the EJAM functions use distance to the average resident of a
block group, which is calculated from the distance to each block’s
internal point and uses the approximation that within a block the
average resident and all residents are as far as that internal point.
For typical distances analyzed in EJAM (e.g., 3 mile radius, or about 5
km) that is a good approximation, since only about 2% of all US blocks
are larger than 1 square mile.</p>
<p>If you need high spatial resolution (block by block) plots of an
indicator as a function of distance, you can directly work with
getblocksnearby() or just use the function plot_distance_by_pctd(). It
uses the distance from the site to each block’s internal point (like a
centroid) rather than just the distance to the average resident in each
block group.</p>
<div class="section level4">
<h4 id="how-demographics-at-one-site-vary-as-a-continuous-function-of-distance">How demographics at <em>ONE SITE</em> vary as <em>a continuous
function of distance</em><a class="anchor" aria-label="anchor" href="#how-demographics-at-one-site-vary-as-a-continuous-function-of-distance"></a>
</h4>
<p>Example of area where %Black is very high within 1 mile but drops by
3 miles away</p>
<div class="sourceCode" id="cb28"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">pts</span> <span class="op">&lt;-</span> <span class="va">testpoints_100</span><span class="op">[</span><span class="fl">3</span>,<span class="op">]</span></span>
<span><span class="va">y</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/plot_distance_by_pctd.html">plot_distance_by_pctd</a></span><span class="op">(</span></span>
<span>  <span class="fu"><a href="../reference/getblocksnearby.html">getblocksnearby</a></span><span class="op">(</span><span class="va">pts</span>, radius <span class="op">=</span> <span class="fl">10</span>, quiet <span class="op">=</span> <span class="cn">T</span><span class="op">)</span>,</span>
<span>  score_colname <span class="op">=</span> <span class="st">"pctnhba"</span>,</span>
<span>  sitenumber <span class="op">=</span> <span class="fl">1</span><span class="op">)</span></span>
<span><span class="co">#&gt; Analyzing 1 points, radius of 10 miles around each.</span></span></code></pre></div>
<div class="figure">
<img src="4_advanced_files/figure-html/plot_distance_by_pctd-1.png" alt="Example of using plot_distance_by_pctd() showing distance on x axis, indicator value within x miles on y axis, for %Black nonhispanic alone as function of distance at site 1, with striking decrease in percent from almost 80% around 0 miles away down to about 20% at 3 or 6 miles away, and showing 20% is the approx US 80th percentile (and state values overall shown as horizontal lines lower than that in this case)" width="672"><p class="caption">
Example of using plot_distance_by_pctd()
</p>
</div>
<div class="sourceCode" id="cb29"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co">#browseURL(url_ejscreen_report(lat = pts$lat, lon = pts$lon, radius = 0.5))</span></span>
<span><span class="co">#browseURL(url_ejscreen_report(lat = pts$lat, lon = pts$lon, radius = 3))</span></span></code></pre></div>
<p>Example of area that has higher %Hispanic as you go 10 to 30 miles
away from this specific point</p>
<div class="sourceCode" id="cb30"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">pts</span> <span class="op">&lt;-</span> <span class="fu">data.table</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/data.table/man/data.table.html" class="external-link">data.table</a></span><span class="op">(</span>lat <span class="op">=</span> <span class="fl">45.75464</span>, lon <span class="op">=</span> <span class="op">-</span><span class="fl">94.36791</span><span class="op">)</span></span>
<span></span>
<span><span class="va">y</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/plot_distance_by_pctd.html">plot_distance_by_pctd</a></span><span class="op">(</span><span class="va">pts</span>,</span>
<span>                      sitenumber <span class="op">=</span> <span class="fl">1</span>, score_colname <span class="op">=</span> <span class="st">"pcthisp"</span><span class="op">)</span></span>
<span><span class="co">#&gt; Analyzing 1 points, radius of 30 miles around each.</span></span></code></pre></div>
<div class="figure">
<img src="4_advanced_files/figure-html/plot_distance_by_pctd2-1.png" alt="Example of using plot_distance_by_pctd(), showing an example where %Hispanic as a function of distance from site number 1 is very low compared to state or US overall, within any distance, but gradually rises from almost zero within 1 mile to just under 5% within about 30 miles away" width="672"><p class="caption">
Example of using plot_distance_by_pctd()
</p>
</div>
<div class="sourceCode" id="cb31"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># browseURL(url_ejscreen_report(lat = pts$lat, lon = pts$lon, radius = 10))</span></span>
<span><span class="co"># browseURL(url_ejscreen_report(lat = pts$lat, lon = pts$lon, radius = 30))</span></span></code></pre></div>
</div>
<div class="section level4">
<h4 id="step-through-all-the-sites-to-see-an-indicator-versus-distance-at-each">
<em>Step through all the sites</em> to see an indicator versus
distance at each<a class="anchor" aria-label="anchor" href="#step-through-all-the-sites-to-see-an-indicator-versus-distance-at-each"></a>
</h4>
<p>Examples of sites analyzed here show some conclusions are very
sensitive to the radius used. The choice of radius in proximity analysis
for some sites will lead to a very different conclusion depending on the
radius analyzed, if only a single distance is checked or reported on.
The relationship between distance X and percent demographics within X
miles can be positive, negative, or roughly flat, etc., depending on the
site and group. The percent demographics may be above or below the US
average or the State average within a given distance of the site.</p>
<p>For the ten sites analyzed in this example, a wide range of patterns
is found:</p>
<ul>
<li><p>At site 5, % low income is extremely high very close to the site
and falls sharply with distance but it remains quite high (still above
80th percentile of US or State) even within 4 miles.</p></li>
<li><p>At site number 2 here, % low income very close to the site is
around the 80th percentile in the State, and is around the US 80th
percentile within about 1 mile, but then it falls to below State and
then US average within around 2 and then 3 miles of the site.</p></li>
<li><p>At site 7, it is below average until about 8 miles, but is above
US and State averages within 10 miles.</p></li>
<li><p>At site 9, it can be above or below average in State and/or in
US, depending on the distance, but it is never as high as the 80th
percentiles.</p></li>
<li><p>At sites 2, 3, 4, and 10, % low income is far below US and State
averages within any distance shown here.</p></li>
</ul>
<div class="sourceCode" id="cb32"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">pts</span> <span class="op">&lt;-</span> <span class="va">testpoints_10</span></span>
<span><span class="va">s2b</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/getblocksnearby.html">getblocksnearby</a></span><span class="op">(</span><span class="va">pts</span>, radius <span class="op">=</span> <span class="fl">10</span>, quiet <span class="op">=</span> <span class="cn">T</span><span class="op">)</span></span>
<span><span class="kw">for</span> <span class="op">(</span><span class="va">i</span> <span class="kw">in</span> <span class="fl">1</span><span class="op">:</span><span class="fu"><a href="https://rdrr.io/r/base/nrow.html" class="external-link">NROW</a></span><span class="op">(</span><span class="va">pts</span><span class="op">)</span><span class="op">)</span> <span class="op">{</span></span>
<span>  <span class="fu"><a href="../reference/plot_distance_by_pctd.html">plot_distance_by_pctd</a></span><span class="op">(</span><span class="va">s2b</span>, sitenumber <span class="op">=</span> <span class="va">i</span>, score_colname <span class="op">=</span> <span class="st">"pctlowinc"</span><span class="op">)</span></span>
<span>  <span class="fu"><a href="https://rdrr.io/r/base/readline.html" class="external-link">readline</a></span><span class="op">(</span><span class="op">)</span> <span class="co"># hit any key to step through the plots</span></span>
<span><span class="op">}</span></span></code></pre></div>
<p>Block by block details are also easy to view in a map of all the
nearby blocks, as shown in the section on [plotblocksnearby()] and
details of blocks near one site.</p>
</div>
<div class="section level4">
<h4 id="cumulative-distribution-plots-of-groups-as-a-continuous-function-of-distance">Cumulative Distribution plots of groups as <em>a continuous function
of distance</em><a class="anchor" aria-label="anchor" href="#cumulative-distribution-plots-of-groups-as-a-continuous-function-of-distance"></a>
</h4>
<p>Out of all the residents within the area analyzed, see how some are
mostly nearby and others are further away, as a CDF plot. This shows the
share of each demographic group residing at various distances from
sites, with distance from nearest site on the x axis and the cumulative
share of each group on the y axis (of all residents within 10 miles,
what percent have a site within X miles?). It compares everyone nearby
to just those who are among the percent low income, and shows that, for
example, a larger share of all the low income population within 10 miles
actually live within about 6 miles than is the case for everyone within
10 miles. In other words, within the 10 mile radius circles, more of the
low income residents are closer to a site than are the non-low income
residents or all residents.</p>
<div class="sourceCode" id="cb33"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span> <span class="co"># out &lt;- ejamit(testpoints_10, radius = 10)</span></span>
<span><span class="fu"><a href="../reference/distance_by_group_plot.html">distance_by_group_plot</a></span><span class="op">(</span></span>
<span>  <span class="va">out</span><span class="op">$</span><span class="va">results_bybg_people</span>,</span>
<span>  demogvarname <span class="op">=</span> <span class="st">'pctlowinc'</span>, demoglabel <span class="op">=</span> <span class="st">'Low Income'</span><span class="op">)</span></span></code></pre></div>
<div class="figure">
<img src="4_advanced_files/figure-html/distance_by_group_plot1-1.png" alt="Example of using distance_by_group_plot()" width="672"><p class="caption">
Example of using distance_by_group_plot()
</p>
</div>
<hr>
</div>
</div>
<div class="section level3">
<h3 id="mean-distance-by-demographic-group">MEAN DISTANCE BY DEMOGRAPHIC GROUP<a class="anchor" aria-label="anchor" href="#mean-distance-by-demographic-group"></a>
</h3>
<p>The analysis described above looks at demographics as a function of
distance. Another perspective is provided by looking at distance as a
function of demographic group. This means looking at the average
distance or the whole distribution of distances (or proximities) among
all the residents within a single demographic group, one group at a
time, and comparing these groups.</p>
<div class="section level4">
<h4 id="overall-list-of-sites-2">Overall list of sites<a class="anchor" aria-label="anchor" href="#overall-list-of-sites-2"></a>
</h4>
<p><em>Mean distance</em> of each group, at the <em>OVERALL LIST of
sites</em> as a whole</p>
<p>To see a table of demographic indicators, showing the mean distance
for each group, compared to distance for those not in that demographic
group:</p>
<div class="sourceCode" id="cb34"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span></span>
<span><span class="va">out</span> <span class="op">&lt;-</span> <span class="va">testoutput_ejamit_1000pts_1miles</span></span>
<span><span class="co">## But try a larger radius to reveal more information:</span></span>
<span><span class="co"># out &lt;- ejamit(testpoints_100, radius = 10)</span></span>
<span></span>
<span><span class="co"># see a table of demog indicators</span></span>
<span><span class="fu"><a href="../reference/distance_mean_by_group.html">distance_mean_by_group</a></span><span class="op">(</span><span class="va">out</span><span class="op">$</span><span class="va">results_bybg_people</span><span class="op">)</span></span>
<span><span class="co">#&gt;                               group nearest nearer ratio avg_distance_for_group</span></span>
<span><span class="co">#&gt; Demog.Ind.              Demog.Index   FALSE  FALSE 1.010                   0.69</span></span>
<span><span class="co">#&gt; Suppl Demog.Ind.   Demog.Index.Supp   FALSE  FALSE 1.010                   0.68</span></span>
<span><span class="co">#&gt; %Low-inc.                 pctlowinc   FALSE   TRUE 0.984                   0.68</span></span>
<span><span class="co">#&gt; %Limited English         pctlingiso   FALSE   TRUE 0.987                   0.68</span></span>
<span><span class="co">#&gt; %Unemployed           pctunemployed   FALSE   TRUE 0.990                   0.68</span></span>
<span><span class="co">#&gt; %&lt; High School              pctlths   FALSE   TRUE 0.986                   0.68</span></span>
<span><span class="co">#&gt; %&lt; age 5                  pctunder5   FALSE  FALSE 1.004                   0.69</span></span>
<span><span class="co">#&gt; %&gt; age 64                 pctover64   FALSE  FALSE 1.002                   0.69</span></span>
<span><span class="co">#&gt; %POC                         pctmin   FALSE   TRUE 0.998                   0.69</span></span>
<span><span class="co">#&gt; %Hispanic                   pcthisp   FALSE   TRUE 0.994                   0.69</span></span>
<span><span class="co">#&gt; %Black NHA                  pctnhba   FALSE  FALSE 1.001                   0.69</span></span>
<span><span class="co">#&gt; %Asian NHA                  pctnhaa   FALSE  FALSE 1.007                   0.69</span></span>
<span><span class="co">#&gt; %AmerIndian/AK NHA       pctnhaiana    TRUE   TRUE 0.930                   0.64</span></span>
<span><span class="co">#&gt; %Hawaiian/PI NHA         pctnhnhpia   FALSE   TRUE 0.983                   0.68</span></span>
<span><span class="co">#&gt; %Other race NHA     pctnhotheralone   FALSE  FALSE 1.021                   0.70</span></span>
<span><span class="co">#&gt; %multirace NH            pctnhmulti   FALSE  FALSE 1.007                   0.69</span></span>
<span><span class="co">#&gt; %White NHA                  pctnhwa   FALSE  FALSE 1.002                   0.69</span></span>
<span><span class="co">#&gt;                    avg_distance_for_nongroup</span></span>
<span><span class="co">#&gt; Demog.Ind.                              0.68</span></span>
<span><span class="co">#&gt; Suppl Demog.Ind.                        0.68</span></span>
<span><span class="co">#&gt; %Low-inc.                               0.69</span></span>
<span><span class="co">#&gt; %Limited English                        0.69</span></span>
<span><span class="co">#&gt; %Unemployed                             0.69</span></span>
<span><span class="co">#&gt; %&lt; High School                          0.69</span></span>
<span><span class="co">#&gt; %&lt; age 5                                0.69</span></span>
<span><span class="co">#&gt; %&gt; age 64                               0.69</span></span>
<span><span class="co">#&gt; %POC                                    0.69</span></span>
<span><span class="co">#&gt; %Hispanic                               0.69</span></span>
<span><span class="co">#&gt; %Black NHA                              0.69</span></span>
<span><span class="co">#&gt; %Asian NHA                              0.69</span></span>
<span><span class="co">#&gt; %AmerIndian/AK NHA                      0.69</span></span>
<span><span class="co">#&gt; %Hawaiian/PI NHA                        0.69</span></span>
<span><span class="co">#&gt; %Other race NHA                         0.69</span></span>
<span><span class="co">#&gt; %multirace NH                           0.69</span></span>
<span><span class="co">#&gt; %White NHA                              0.69</span></span>
<span></span>
<span><span class="co"># for just 1 indicator</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/print.html" class="external-link">print</a></span><span class="op">(</span><span class="fu"><a href="../reference/distance_mean_by_group.html">distance_mean_by_group</a></span><span class="op">(</span></span>
<span>  <span class="va">out</span><span class="op">$</span><span class="va">results_bybg_people</span>, </span>
<span>  demogvarname <span class="op">=</span> <span class="st">'pctlowinc'</span>, demoglabel <span class="op">=</span> <span class="st">'Low Income'</span><span class="op">)</span><span class="op">)</span></span>
<span><span class="co">#&gt;                group nearest nearer ratio avg_distance_for_group</span></span>
<span><span class="co">#&gt; Low Income pctlowinc    TRUE   TRUE 0.984                   0.68</span></span>
<span><span class="co">#&gt;            avg_distance_for_nongroup</span></span>
<span><span class="co">#&gt; Low Income                      0.69</span></span></code></pre></div>
<p>To see a barplot, comparing just race/ethnicity groups:</p>
<div class="sourceCode" id="cb35"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/plot_distance_mean_by_group.html">plot_distance_mean_by_group</a></span><span class="op">(</span><span class="va">out</span><span class="op">$</span><span class="va">results_bybg_people</span>, </span>
<span>                       demogvarname <span class="op">=</span> <span class="va">names_d_subgroups</span>,</span>
<span>                       demoglabel <span class="op">=</span> <span class="fu"><a href="../reference/fixcolnames.html">fixcolnames</a></span><span class="op">(</span><span class="va">names_d_subgroups</span>, <span class="st">"r"</span>, <span class="st">"shortlabel"</span><span class="op">)</span></span>
<span>                       <span class="op">)</span></span></code></pre></div>
<div class="figure">
<img src="4_advanced_files/figure-html/plot_distance_mean_by_group999-1.png" alt="Example of using plot_distance_mean_by_group() showing 8 race ethnic subgroups on x axis and average distance for those in group as ratio to distance for residents not in given group, with yellow bars for hispanic and hawaiian/PI nonhispanic yellow meaning they are closer than overall average resident and orange for American Indian nonhispanic alone meaning they are only 93% as far as everyone else, 0.64 vs 0.69 miles away" width="672"><p class="caption">
Example of using plot_distance_mean_by_group()
</p>
</div>
<pre><code><span><span class="co">#&gt;                              group nearest nearer ratio avg_distance_for_group</span></span>
<span><span class="co">#&gt; %Hispanic                  pcthisp   FALSE   TRUE 0.994                   0.69</span></span>
<span><span class="co">#&gt; %Black NHA                 pctnhba   FALSE  FALSE 1.001                   0.69</span></span>
<span><span class="co">#&gt; %Asian NHA                 pctnhaa   FALSE  FALSE 1.007                   0.69</span></span>
<span><span class="co">#&gt; %AmerIndian/AK NHA      pctnhaiana    TRUE   TRUE 0.930                   0.64</span></span>
<span><span class="co">#&gt; %Hawaiian/PI NHA        pctnhnhpia   FALSE   TRUE 0.983                   0.68</span></span>
<span><span class="co">#&gt; %Other race NHA    pctnhotheralone   FALSE  FALSE 1.021                   0.70</span></span>
<span><span class="co">#&gt; %multirace NH           pctnhmulti   FALSE  FALSE 1.007                   0.69</span></span>
<span><span class="co">#&gt; %White NHA                 pctnhwa   FALSE  FALSE 1.002                   0.69</span></span>
<span><span class="co">#&gt;                    avg_distance_for_nongroup</span></span>
<span><span class="co">#&gt; %Hispanic                               0.69</span></span>
<span><span class="co">#&gt; %Black NHA                              0.69</span></span>
<span><span class="co">#&gt; %Asian NHA                              0.69</span></span>
<span><span class="co">#&gt; %AmerIndian/AK NHA                      0.69</span></span>
<span><span class="co">#&gt; %Hawaiian/PI NHA                        0.69</span></span>
<span><span class="co">#&gt; %Other race NHA                         0.69</span></span>
<span><span class="co">#&gt; %multirace NH                           0.69</span></span>
<span><span class="co">#&gt; %White NHA                              0.69</span></span></code></pre>
</div>
<div class="section level4">
<h4 id="site-by-site-comparison-1">Site by site comparison<a class="anchor" aria-label="anchor" href="#site-by-site-comparison-1"></a>
</h4>
<p><em>Mean distance</em> of each group, at <em>EACH SITE</em>, as ratio
to mean of everyone else nearby</p>
<p>Ratios at each site, of avg dist of group / avg dist of everyone else
near site:</p>
<div class="sourceCode" id="cb37"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span></span>
<span><span class="va">out</span> <span class="op">&lt;-</span> <span class="va">testoutput_ejamit_10pts_1miles</span></span>
<span><span class="co">## But try a larger radius to reveal more information:</span></span>
<span><span class="co"># out &lt;- ejamit(testpoints_10, radius = 31)</span></span>
<span></span>
<span><span class="va">x</span> <span class="op">=</span> <span class="fu"><a href="../reference/distance_by_group_by_site.html">distance_by_group_by_site</a></span><span class="op">(</span><span class="va">out</span><span class="op">$</span><span class="va">results_bybg_people</span><span class="op">)</span></span>
<span><span class="va">x</span></span>
<span></span>
<span><span class="co"># summary of closest group at each site and by how much</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/data.frame.html" class="external-link">data.frame</a></span><span class="op">(</span>site <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/colnames.html" class="external-link">colnames</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span>, </span>
<span>           closestgroup <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/colnames.html" class="external-link">rownames</a></span><span class="op">(</span><span class="va">x</span><span class="op">)</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/lapply.html" class="external-link">sapply</a></span><span class="op">(</span><span class="va">x</span>, <span class="va">which.min</span><span class="op">)</span><span class="op">]</span>, </span>
<span>           their_avg_distance_as_pct_of_everyone_elses <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/Round.html" class="external-link">round</a></span><span class="op">(</span><span class="fl">100</span> <span class="op">*</span> <span class="fu"><a href="https://rdrr.io/r/base/lapply.html" class="external-link">sapply</a></span><span class="op">(</span><span class="va">x</span>, <span class="va">min</span>, na.rm <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span>, <span class="fl">0</span><span class="op">)</span></span>
<span><span class="op">)</span></span></code></pre></div>
<hr>
</div>
</div>
<div class="section level3">
<h3 id="background-and-overview-of-issues-in-proximity-distance-or-radius">BACKGROUND AND OVERVIEW OF ISSUES IN PROXIMITY, DISTANCE, OR
RADIUS<a class="anchor" aria-label="anchor" href="#background-and-overview-of-issues-in-proximity-distance-or-radius"></a>
</h3>
<p>Distance from a potential source of environmental risk is often used
as a simple proxy for actual exposure or risk, when data are limited.
Proximity analysis uses distance (how far away) from a site, which is
just the opposite of proximity (how near) to a site.</p>
<p>Conclusions can be sensitive to the choice of radius, if only one
radius is reported on, as shown in [Step through all the sites to see an
indicator versus distance at each].</p>
<div class="section level4">
<h4 id="demographics-by-distance-or-distance-by-demographic-group">Demographics-by-distance or distance-by-demographic group?<a class="anchor" aria-label="anchor" href="#demographics-by-distance-or-distance-by-demographic-group"></a>
</h4>
<p>Two basic ways to report demographics and risk are 1) showing
demographics as a function or risk, and 2) showing risk as a function of
demographics:</p>
<ol style="list-style-type: decimal">
<li><p>Demographics as a function of risk (or proximity): Many proximity
analyses report percent demographics by distance or risk bin, such as %
low income within 3 miles of a point. This expresses demographics as a
function of proximity or risk. Sometimes other distance or risk bins are
used, such as areas with risk above some cutoff. And sometimes instead
of a continuous measure of % demographics, the demographic data are used
to categorize places in bins, such as areas in the top quartile of
poverty rates.</p></li>
<li><p>Risk (or proximity) as a function of demographics: A different
way to present this information is to report distance or risk as a
function of demographic group – this expresses distance within each
demographic group, such as the average distance by group or the full
distribution of risk within each group.</p></li>
</ol>
</div>
<div class="section level4">
<h4 id="radius-radii-or-continuous-distance">Radius, radii, or continuous distance?<a class="anchor" aria-label="anchor" href="#radius-radii-or-continuous-distance"></a>
</h4>
<p>Proximity or distance as binary, categorical, or continuous metrics:
Proximity analysis has often relied on picking a single distance, a
radius, and analyzing conditions within that radius, such as all
residents who live within 3 miles of a point where a regulated facility
is located. Sometimes an analysis will look at two or even three
distances. In some more sophisticated analyses, distance is treated as a
continuous measure. Some tools like EJScreen use a proximity metric
based on the inverse of distance (1/d) to provide a proximity score that
gets higher as distance gets smaller. But many EJ analyses still use a
single distance and analyze conditions within that distance.</p>
<p>EJAM makes it easier to do any of these types of analysis, because
conclusions can be sensitive to the choice of a single radius, and
metrics and methods provide different perspectives and reveal a richer
picture of where people actually live in relation to potential sources
of exposure or risk.</p>
</div>
<div class="section level4">
<h4 id="comparisons-within-what-distances-or-to-what-reference-areas">Comparisons within what distances or to what reference area(s)?<a class="anchor" aria-label="anchor" href="#comparisons-within-what-distances-or-to-what-reference-areas"></a>
</h4>
<p>This is a tricky issue in proximity analysis: There is a subtle but
vital difference between proximity analysis using a single radius
(binary distance) and analysis using continuous distance. One way to
think of this is that there are two aspects of or degrees of proximity
to consider when analyzing demographic groups within a certain fixed
distance (radius) from a single facility point (or a whole set of
facilities). These two ways of summarizing proximity are
complementary:</p>
<ol style="list-style-type: decimal">
<li><p>Which groups tend to live nearby in the sense of being
<strong>within the radius versus outside the radius</strong> selected?
In other words, which groups are “overrepresented” within X miles of the
site? This treats proximity as a yes/no, binomial question – <strong>a
resident is nearby or not</strong>. It would focus on whether someone is
anywhere within 3 miles, say, and ignore the differences between being
1, 2, or 3 miles away. Most proximity analysis has tended to look at
this type of summary.</p></li>
<li><p>Among the residents within X miles of the site, which groups live
especially close to the facility? This question recognizes proximity is
a continuous variable, and focuses on the difference between 1 mile, 1.5
miles, etc. However, it only looks at residents within the X miles
radius area analyzed, so it fails to recognize that some groups tend to
live more than 3 miles away, for example. This perspective does not take
into account which groups are overrepresented within the original total
radius near a site.</p></li>
</ol>
<p>Some functions like distance_mean_by_group() or
distance_by_group_by_site() do the second of these two types of
analysis. They report, only among those anywhere inside the radius,
which groups are closer to the site.</p>
<p>In a specific location, for example, one demographic group could be
underrepresented within 3 miles, but those few who are in the group
still might live right next to the facility in which case their average
distance would be higher than that of any other group because this
function only counts those within the radius analyzed.</p>
<p>In some other location, the opposite could occur – if one group is
overrepresented within 3 miles, they still might all live in a community
about 2.9 miles away from the site – that would mean their distance from
the site on average is greater (or their proximity score is lower) than
other groups within 3 miles of the site.</p>
<p>The question of whether to compare to Statewide or Nationwide or
urban/rural or other reference averages or percentiles is related to
this question of how to look at distances, or exposures or risk, just
like it relates to how to look at demographic percentages. One could
look at % demographics within 1 mile, 2 miles, etc. all the way out
until one was looking at the county overall, the state overall, and
eventually the nation overall. Selecting a single radius or selecting a
single reference area should be done with a recognition of what
questions one is actually trying to answer, and an understanding of how
impacts vary with distance from a particular type of facility or source
of potential risk.</p>
<p>If one is comparing demographic groups in terms of distance (or risk
level), or if one is comparing % demographics at each distance (or risk
level), the implicit assumption is that there is some “expected” rate,
and/or some “equitable” or “proportionate” % or ratio or risk.</p>
</div>
</div>
<div class="section level3">
<h3 id="choice-of-radius-and-uncertainty-due-to-a-small-radius-where-blocks-are-large">CHOICE OF RADIUS AND UNCERTAINTY DUE TO A SMALL RADIUS WHERE BLOCKS
ARE LARGE<a class="anchor" aria-label="anchor" href="#choice-of-radius-and-uncertainty-due-to-a-small-radius-where-blocks-are-large"></a>
</h3>
<p>Choosing a radius (or polygon) that is small relative to local Census
blocks can lead to significant uncertainty in EJAM/EJScreen estimates,
so it is important to understand the details if one wants to use a small
radius especially in rural (low population density) areas.</p>
<p>To help consider this uncertainty, EJAM reports how many block
centroids were found inside each area (inside a circular buffer defined
by the selected radius, or inside a polygon that is from a shapefile).
That count of blocks is found in a column of the spreadsheet output
provided by the web app and also the table called results_bysite that is
one output of the ejamit() function.</p>
<p>You could also <a href="#map-all-sites-with-popup-at-each-saying-how-many-blocks-were-found-nearby">Map
all sites with popup at each saying how many blocks were found
nearby</a> and therefore might have more uncertainty in counts
nearby.</p>
<div class="sourceCode" id="cb38"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># out &lt;- ejamit(testpoints_1000, radius = 1)</span></span>
<span><span class="co"># out$results_bysite$blockcount_near_site</span></span>
<span><span class="va">out</span> <span class="op">&lt;-</span> <span class="va">testoutput_ejamit_1000pts_1miles</span></span>
<span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/barplot.html" class="external-link">barplot</a></span><span class="op">(</span></span>
<span>  <span class="fu"><a href="https://rdrr.io/r/base/table.html" class="external-link">table</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/cut.html" class="external-link">cut</a></span><span class="op">(</span></span>
<span>    <span class="va">out</span><span class="op">$</span><span class="va">results_bysite</span><span class="op">$</span><span class="va">blockcount_near_site</span>,  </span>
<span>    <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="op">-</span><span class="fl">1</span>, <span class="fl">9</span>, <span class="fl">29</span>, <span class="fl">100</span>, <span class="fl">1000</span><span class="op">)</span></span>
<span>  <span class="op">)</span><span class="op">)</span>,</span>
<span>  names.arg <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">"&lt; 10 blocks"</span>, <span class="st">"10-29"</span>, <span class="st">"30-100"</span>, <span class="st">"&gt; 100 blocks"</span><span class="op">)</span>,</span>
<span>  main <span class="op">=</span> <span class="st">"How many blocks are within 1 mile of these 1,000 facilities?"</span>,</span>
<span>  ylab <span class="op">=</span> <span class="st">"# of facilities"</span>, </span>
<span>  xlab <span class="op">=</span> <span class="st">"# of blocks nearby"</span></span>
<span><span class="op">)</span></span></code></pre></div>
<p>For more details about distance adjustments, overlaps of circles,
etc.</p>
<p>This function prints a very large amount of diagnostic information,
and provides a barplot histogram showing in this case that almost none
of the 1000 sites have zero blocks within a mile but roughly 10-15% have
under 10 blocks nearby and a similar share have only 10-29 blocks
nearby.</p>
<div class="sourceCode" id="cb39"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># (Printed information is lengthy)</span></span>
<span></span>
<span>  <span class="fu"><a href="../reference/getblocks_diagnostics.html">getblocks_diagnostics</a></span><span class="op">(</span></span>
<span>  <span class="va">testoutput_getblocksnearby_1000pts_1miles</span>,</span>
<span>  <span class="co"># getblocksnearby(testpoints_1000, radius = 1, quiet = T),</span></span>
<span>  detailed <span class="op">=</span> <span class="cn">T</span>, see_pctiles <span class="op">=</span> <span class="cn">T</span></span>
<span>  <span class="op">)</span></span></code></pre></div>
<div class="section level4">
<h4 id="suggestions-on-radius-and-uncertainty">Suggestions on radius and uncertainty<a class="anchor" aria-label="anchor" href="#suggestions-on-radius-and-uncertainty"></a>
</h4>
<p>Here are some suggestions about how to consider the radius in
relation to uncertainty where blocks are large:</p>
<ul>
<li>A closer look at uncertainty and care in communicating uncertainty
may be needed where a circle or polygon contains fewer than about 30
block centroids. That is especially important if it contains fewer than
about 10, and essential if it contains only 1 or zero block
centroids.</li>
<li>Using a radius of 5 miles or more does not raise these issues in 99%
of US locations where EPA-regulated facilities are found.</li>
<li>A radius of 3 miles might need a closer look for about 1% to 5% of
typical sites in the US.</li>
<li>A radius of 1 mile or less requires caution and understanding of the
issues at a significant share of locations in the US (about 1 in 4
locations might need a closer look to check for uncertainties).</li>
<li>A 0.5 mile radius should not be used without cautious interpretation
or offline analysis in most locations where EPA-regulated facilities are
located.</li>
<li>A 0.25 mile radius should only be used on a case-by-case basis where
each location is examined individually and other methods are likely more
suited for the analysis of those sites.</li>
</ul>
<p>These considerations are explained further in the discussion
below.</p>
<p>Demographic counts and percentages or environmental indicators are
calculated from block group demographic and environmental indicators and
an estimate of what fraction of each block group is inside each site.
For proximity analysis that means a circle is drawn around a point using
a radius, and for shapefiles a similar approach is used. In either case,
the fraction of the block group counted as inside the area analyzed is
based on which block centroids (each is technically called a block
“internal point”) are inside the circle or polygon. All the residents of
a block are assumed to be inside if the block centroid is inside. This
is exactly true unless a block is on the edge of the circle or polygon.
Even for the ones on the edge, some centroids are just outside and some
just inside the shape, so the contributions of some blocks are
overcounted and other undercounted, but those tend to cancel each other
out in the sense that it is unlikely they would all be undercounted, for
example. Still, when a large share of the block points in circle or
polygon are from blocks not entirely inside, uncertainty is higher than
when the vast majority of blocks are entirely inside. In other words, if
the circle or polygon has a very large number of blocks in it,
uncertainty is lower because only a small fraction are along the edge
and bisected. If a radius of 3 miles is used, the area is 28 square
miles. If the blocks in that location are only about 0.28 square miles
each, the circle might contain or partly contain about 100 blocks.</p>
<p>The dataset used by EJAM called blockwts has a column called
block_radius_miles that is what the radius would be if the block were
circular, and it was created based on area = pi * block_radius_miles^2
or block_radius_miles = sqrt(area / pi) where area is in square
miles.</p>
</div>
<div class="section level4">
<h4 id="details-on-the-blocks-found-near-one-site">Details on the blocks found near one site<a class="anchor" aria-label="anchor" href="#details-on-the-blocks-found-near-one-site"></a>
</h4>
<div class="section level5">
<h5 id="table-of-distances-between-each-site-and-each-block">Table of distances between each site and each block<a class="anchor" aria-label="anchor" href="#table-of-distances-between-each-site-and-each-block"></a>
</h5>
<p>Use <code><a href="../reference/getblocksnearby.html">getblocksnearby()</a></code> to quickly find residents/blocks
that are within a specified distance, as a table of distances between
sites and nearby blocks.</p>
<div class="sourceCode" id="cb40"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">sitepoints</span> <span class="op">&lt;-</span> <span class="va">testpoints_10</span><span class="op">[</span><span class="fl">1</span><span class="op">:</span><span class="fl">2</span>, <span class="op">]</span></span>
<span></span>
<span><span class="va">sites2blocks</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/getblocksnearby.html">getblocksnearby</a></span><span class="op">(</span></span>
<span>  sitepoints <span class="op">=</span> <span class="va">sitepoints</span>,</span>
<span>  radius <span class="op">=</span> <span class="fl">3.1</span></span>
<span><span class="op">)</span></span>
<span><span class="co">#&gt; Analyzing 2 points, radius of 3.1 miles around each.</span></span>
<span><span class="co">#&gt; Finding Census blocks with internal point within  3.1  miles of the site (point), for each of 2  sites (points)...</span></span>
<span><span class="co">#&gt; Stats via getblocks_diagnostics(), but NOT ADJUSTING UP FOR VERY SHORT DISTANCES: </span></span>
<span><span class="co">#&gt; min distance before adjustment:  0.06504053 </span></span>
<span><span class="co">#&gt; max distance before adjustment:  4.670403</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">head</a></span><span class="op">(</span><span class="va">sites2blocks</span><span class="op">)</span></span>
<span><span class="co">#&gt; Key: &lt;blockid&gt;</span></span>
<span><span class="co">#&gt;    ejam_uniq_id blockid distance    blockwt  bgid distance_unadjusted</span></span>
<span><span class="co">#&gt;           &lt;int&gt;   &lt;int&gt;    &lt;num&gt;      &lt;num&gt; &lt;int&gt;               &lt;num&gt;</span></span>
<span><span class="co">#&gt; 1:            2     296 2.946818 0.00000000    15            2.946818</span></span>
<span><span class="co">#&gt; 2:            2     297 3.040476 0.00000000    15            3.040476</span></span>
<span><span class="co">#&gt; 3:            2     773 2.925869 0.07083906    32            2.925869</span></span>
<span><span class="co">#&gt; 4:            2     780 2.873082 0.03576341    32            2.873082</span></span>
<span><span class="co">#&gt; 5:            2     781 2.739460 0.05249885    32            2.739460</span></span>
<span><span class="co">#&gt; 6:            2     786 3.077032 0.03163686    32            3.077032</span></span></code></pre></div>
</div>
<div class="section level5">
<h5 id="detailed-stats-on-blocks-found-near-sites">Detailed stats on blocks found near site(s)<a class="anchor" aria-label="anchor" href="#detailed-stats-on-blocks-found-near-sites"></a>
</h5>
<div class="sourceCode" id="cb41"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">x</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/getblocks_diagnostics.html">getblocks_diagnostics</a></span><span class="op">(</span><span class="va">sites2blocks</span><span class="op">)</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;    DISTANCES FROM BLOCKS (AND RESIDENTS) TO SITES (AND FOR CLOSEST SITE) </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; 3.097412 miles is max. distance to block internal point (distance_unadjusted)   </span></span>
<span><span class="co">#&gt; 3.097412 miles is max. distance to average resident in block (distance reported)   </span></span>
<span><span class="co">#&gt; 0.06504053 miles is shortest distance to block internal point (distance_unadjusted)   </span></span>
<span><span class="co">#&gt; 0.06504053 miles is shortest distance to average resident in block (distance reported)   </span></span>
<span><span class="co">#&gt; 0 block distances were adjusted (these stats may count some blocks twice if adjusted at 2+ sites)</span></span>
<span><span class="co">#&gt;   0 block distances were adjusted up (reported dist to avg resident is &gt; dist to block internal point)</span></span>
<span><span class="co">#&gt;   0 block distances were adjusted down (reported &lt; unadjusted)</span></span>
<span><span class="co">#&gt; 0 unique sites had one or more block distances adjusted due to large block and short distance to block point</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;   BLOCK COUNTS PER SITE (FEWER MEANS HIGHER UNCERTAINTY AT THOSE SITES)</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; 362 blocks are near the avg site or in avg buffer</span></span>
<span><span class="co">#&gt; (based on their block internal point, like a centroid)</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;   sites    blocks_per_site</span></span>
<span><span class="co">#&gt; 1     0         Not even 1</span></span>
<span><span class="co">#&gt; 2     0       some but &lt;10</span></span>
<span><span class="co">#&gt; 3     0              10-29</span></span>
<span><span class="co">#&gt; 4     2 at least 30 blocks</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;   BLOCK COUNTS TOTAL AND IN OVERLAPS OF AREAS (MULTIPLE SITES FOR SOME RESIDENTS) </span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; 723 actual unique blocks total</span></span>
<span><span class="co">#&gt; 723 blocks including doublecounting in overlaps, </span></span>
<span><span class="co">#&gt;              in final row count (block-to-site pairs table)</span></span>
<span><span class="co">#&gt; 1 is ratio of blocks including multicounting / actual count of unique blocks</span></span>
<span><span class="co">#&gt; 0% of unique blocks could get counted more than once </span></span>
<span><span class="co">#&gt;              because those residents are near two or more sites </span></span>
<span><span class="co">#&gt;              (assuming they live at the block internal point</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt;   SITE COUNTS TOTAL AND IN OVERLAPS OF AREAS (MULTIPLE SITES FOR SOME RESIDENTS)</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; 2 unique output sites</span></span>
<span><span class="co">#&gt; </span></span>
<span><span class="co">#&gt; 723 blocks (and their residents) have exactly 1 site nearby </span></span>
<span><span class="co">#&gt; 0 blocks (and their residents) have exactly 2 sites nearby </span></span>
<span><span class="co">#&gt; 0 blocks (and their residents) have exactly 3 sites nearby</span></span></code></pre></div>
<div class="figure">
<img src="4_advanced_files/figure-html/getblocks_diagnostics_simple-1.png" alt="Example of getblocks_diagnostics() to see tables and histogram barplot of how many blocks are within 3.1 miles of these 2 sites, showing in this case they have at least 30 each" width="672"><p class="caption">
Example of getblocks_diagnostics() to see tables and histogram barplot
of how many blocks are within 3.1 miles of these 2 sites
</p>
</div>
<div class="sourceCode" id="cb42"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span></span>
<span><span class="co"># x &lt;- getblocks_summarize_blocks_per_site(sites2blocks) </span></span>
<span><span class="co"># print(x) shows more info returned invisibly</span></span></code></pre></div>
</div>
<div class="section level5">
<h5 id="map-1-site-to-inspect-the-blocks-nearby">Map 1 site to inspect the blocks nearby<a class="anchor" aria-label="anchor" href="#map-1-site-to-inspect-the-blocks-nearby"></a>
</h5>
<p>Clicking on a block point provides a popup window showing information
such as this:</p>
<pre><code><span><span class="va">blockfips</span><span class="op">:</span> <span class="fl">131850102031056</span></span>
<span><span class="va">blockid</span><span class="op">:</span> <span class="fl">1788737</span></span>
<span><span class="va">blocklat</span><span class="op">:</span> <span class="fl">30.9913730000001</span></span>
<span><span class="va">blocklon</span><span class="op">:</span> <span class="op">-</span><span class="fl">83.3753460999999</span></span>
<span><span class="va">distance</span><span class="op">:</span> <span class="fl">1.03614020347595</span></span>
<span><span class="va">distance_unadjusted</span><span class="op">:</span> <span class="fl">1.03614020347595</span></span>
<span><span class="va">blockwt</span><span class="op">:</span> <span class="fl">0</span></span>
<span><span class="va">blockpop</span><span class="op">:</span> <span class="fl">0</span></span>
<span><span class="va">pop_nearby</span><span class="op">:</span> <span class="fl">6237</span></span>
<span><span class="va">bgpop</span><span class="op">:</span> <span class="fl">1281</span></span>
<span><span class="va">bgfips</span><span class="op">:</span> <span class="fl">131850102031</span></span>
<span><span class="va">bgid</span><span class="op">:</span> <span class="fl">64286</span></span>
<span><span class="va">ejam_uniq_id</span><span class="op">:</span> <span class="fl">1</span></span>
<span><span class="va">blockcount_near_site</span><span class="op">:</span> <span class="fl">219</span></span></code></pre>
<div class="sourceCode" id="cb44"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">x</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/plotblocksnearby.html">plotblocksnearby</a></span><span class="op">(</span><span class="va">testpoints_10</span><span class="op">[</span><span class="fl">1</span>, <span class="op">]</span>, radius <span class="op">=</span> <span class="fl">3</span>, returnmap <span class="op">=</span> <span class="cn">F</span><span class="op">)</span></span>
<span><span class="co">#&gt; Analyzing 1 points, radius of 3 miles around each.</span></span>
<span><span class="co">#&gt; Finding Census blocks with internal point within  3  miles of the site (point), for each of 1  sites (points)...</span></span>
<span><span class="co">#&gt; Stats via getblocks_diagnostics(), but NOT ADJUSTING UP FOR VERY SHORT DISTANCES: </span></span>
<span><span class="co">#&gt; min distance before adjustment:  0.2321264 </span></span>
<span><span class="co">#&gt; max distance before adjustment:  4.412158</span></span>
<span><span class="co"># Set returnmap= TRUE to actually return a leaflet map</span></span></code></pre></div>
</div>
</div>
</div>
<div class="section level3">
<h3 id="population-density-why-the-avg-site-and-avg-resident-are-so-different">POPULATION DENSITY – WHY THE AVG SITE AND AVG RESIDENT ARE SO
DIFFERENT<a class="anchor" aria-label="anchor" href="#population-density-why-the-avg-site-and-avg-resident-are-so-different"></a>
</h3>
<p>Reporting EJAM information summarized for the average site gives very
different answers than reporting on the average resident near any one or
more of those sites. The average site and average resident are
completely different because most of the residents live near just a few
of the sites – the ones with higher population density – when one is
using a fixed radius at all sites, such as 3 miles from each site.
Taking the average of sites gives equal weight to each site, even the
ones with very few residents around them. Taking the average of all
residents near all the sites gives equal weight to each person, so
conditions near certain sites affect more people and have more influence
on that average.</p>
<div class="section level4">
<h4 id="sites-vary-widely-in-count-of-blocks-nearby-depending-on-population-density-which-is-closely-related-to-block-area-in-square-miles">Sites vary widely in count of blocks nearby, depending on population
density (which is closely related to block area in square miles)<a class="anchor" aria-label="anchor" href="#sites-vary-widely-in-count-of-blocks-nearby-depending-on-population-density-which-is-closely-related-to-block-area-in-square-miles"></a>
</h4>
<ul>
<li>what blocks are near each site</li>
<li>how far are they</li>
<li>how many blocks are typically near a given site (population density
varies)</li>
<li>how many sites are near a block (residents with &gt; 1 site
nearby)</li>
</ul>
<div class="sourceCode" id="cb45"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">out</span> <span class="op">&lt;-</span> <span class="va">testoutput_ejamit_100pts_1miles</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/cat.html" class="external-link">cat</a></span><span class="op">(</span><span class="st">"  "</span>, <span class="fu"><a href="../reference/popshare_p_lives_at_what_pct.html">popshare_p_lives_at_what_pct</a></span><span class="op">(</span><span class="va">out</span><span class="op">$</span><span class="va">results_bysite</span><span class="op">$</span><span class="va">pop</span>, p <span class="op">=</span> <span class="fl">0.50</span>, astext <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span>, <span class="st">"\n"</span><span class="op">)</span></span>
<span><span class="co">#&gt;    6% of places account for 50% of the total population (approx.)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/cat.html" class="external-link">cat</a></span><span class="op">(</span><span class="st">"  "</span>, <span class="fu"><a href="../reference/popshare_at_top_n.html">popshare_at_top_n</a></span><span class="op">(</span><span class="va">out</span><span class="op">$</span><span class="va">results_bysite</span><span class="op">$</span><span class="va">pop</span>, <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="fl">1</span>, <span class="fl">5</span>, <span class="fl">10</span><span class="op">)</span>, astext <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span>, <span class="st">"\n\n"</span><span class="op">)</span></span>
<span><span class="co">#&gt;    1, 5, 10 places account for 17%, 46%, 58% of the total population</span></span></code></pre></div>
<p>Find all blocks nearby each site</p>
<div class="sourceCode" id="cb46"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">radius</span> <span class="op">&lt;-</span> <span class="fl">3</span></span>
<span><span class="va">sitepoints</span> <span class="op">&lt;-</span> <span class="va">testpoints_100</span></span>
<span><span class="va">sites2blocks</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/getblocksnearby.html">getblocksnearby</a></span><span class="op">(</span><span class="va">sitepoints</span>, <span class="va">radius</span>, quadtree <span class="op">=</span> <span class="va">localtree</span>, quiet <span class="op">=</span> <span class="cn">TRUE</span><span class="op">)</span></span>
<span><span class="co">#&gt; Analyzing 100 points, radius of 3 miles around each.</span></span>
<span><span class="co"># testoutput_getblocksnearby_10pts_1miles is also available as an example</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/names.html" class="external-link">names</a></span><span class="op">(</span><span class="va">sites2blocks</span><span class="op">)</span></span>
<span><span class="co">#&gt; [1] "ejam_uniq_id"        "blockid"             "distance"           </span></span>
<span><span class="co">#&gt; [4] "blockwt"             "bgid"                "distance_unadjusted"</span></span></code></pre></div>
<p>Very few blocks are within a radius of 1/4 mile.</p>
<p>Hundreds are often within 1 mile, but sometimes there are only a
handful or even zero.</p>
<div class="sourceCode" id="cb47"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span></span>
<span><span class="va">s2b_stats</span> <span class="op">&lt;-</span> <span class="va">sites2blocks</span><span class="op">[</span> , <span class="fu">.</span><span class="op">(</span></span>
<span>  avgDistance <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/Round.html" class="external-link">round</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/base/mean.html" class="external-link">mean</a></span><span class="op">(</span><span class="va">distance</span><span class="op">)</span>, <span class="fl">2</span><span class="op">)</span>,</span>
<span>  blocksfound <span class="op">=</span> <span class="va">.N</span>, </span>
<span>  blocks_within_1mile <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/sum.html" class="external-link">sum</a></span><span class="op">(</span><span class="va">distance</span> <span class="op">&lt;=</span> <span class="fl">1</span><span class="op">)</span>,</span>
<span>  blocks_within_0.75   <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/sum.html" class="external-link">sum</a></span><span class="op">(</span><span class="va">distance</span> <span class="op">&lt;=</span> <span class="fl">0.75</span><span class="op">)</span>,</span>
<span>  blocks_within_0.25  <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/sum.html" class="external-link">sum</a></span><span class="op">(</span><span class="va">distance</span> <span class="op">&lt;=</span> <span class="fl">0.25</span><span class="op">)</span></span>
<span><span class="op">)</span>, by <span class="op">=</span> <span class="st">'ejam_uniq_id'</span><span class="op">]</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/order.html" class="external-link">order</a></span><span class="op">(</span><span class="va">blocksfound</span><span class="op">)</span>, <span class="op">]</span></span>
<span><span class="fu"><a href="https://rdrr.io/pkg/data.table/man/setorder.html" class="external-link">setorder</a></span><span class="op">(</span><span class="va">s2b_stats</span>, <span class="va">ejam_uniq_id</span><span class="op">)</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">head</a></span><span class="op">(</span><span class="va">s2b_stats</span><span class="op">)</span></span>
<span><span class="co">#&gt;    ejam_uniq_id avgDistance blocksfound blocks_within_1mile blocks_within_0.75</span></span>
<span><span class="co">#&gt;           &lt;int&gt;       &lt;num&gt;       &lt;int&gt;               &lt;int&gt;              &lt;int&gt;</span></span>
<span><span class="co">#&gt; 1:            1        1.66         341                  88                 61</span></span>
<span><span class="co">#&gt; 2:            2        2.13          56                   3                  2</span></span>
<span><span class="co">#&gt; 3:            3        1.50        2111                 620                378</span></span>
<span><span class="co">#&gt; 4:            4        1.65         735                 210                130</span></span>
<span><span class="co">#&gt; 5:            5        0.90         405                 298                255</span></span>
<span><span class="co">#&gt; 6:            6        2.00          48                   4                  4</span></span>
<span><span class="co">#&gt;    blocks_within_0.25</span></span>
<span><span class="co">#&gt;                 &lt;int&gt;</span></span>
<span><span class="co">#&gt; 1:                  6</span></span>
<span><span class="co">#&gt; 2:                  0</span></span>
<span><span class="co">#&gt; 3:                 36</span></span>
<span><span class="co">#&gt; 4:                 12</span></span>
<span><span class="co">#&gt; 5:                 50</span></span>
<span><span class="co">#&gt; 6:                  0</span></span></code></pre></div>
</div>
<div class="section level4">
<h4 id="cdf-of-how-many-blocks-are-nearby-a-site">CDF of how many blocks are nearby a site<a class="anchor" aria-label="anchor" href="#cdf-of-how-many-blocks-are-nearby-a-site"></a>
</h4>
<div class="figure">
<img src="4_advanced_files/figure-html/plot_count_of_blocks_nearby-1.png" alt="scatterplot of 100 ranked sites with y axis showing count of blocks nearby rising from zero to almost 800 blocks at a given site, and around 150-200 at the average site" width="576"><p class="caption">
How many blocks are near each of these 100 facilities?
</p>
</div>
</div>
<div class="section level4">
<h4 id="histogram-and-table-showing-how-many-blocks-are-nearby-a-site">Histogram and table showing how many blocks are nearby a site<a class="anchor" aria-label="anchor" href="#histogram-and-table-showing-how-many-blocks-are-nearby-a-site"></a>
</h4>
<div class="sourceCode" id="cb48"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span></span>
<span><span class="fu"><a href="https://rdrr.io/r/graphics/hist.html" class="external-link">hist</a></span><span class="op">(</span><span class="va">sites2blocks</span><span class="op">[</span>,<span class="va">.N</span>, by <span class="op">=</span> <span class="st">"ejam_uniq_id"</span><span class="op">]</span><span class="op">[</span>, <span class="va">N</span><span class="op">]</span>, <span class="fl">20</span>, </span>
<span>     xlab <span class="op">=</span> <span class="st">"How many blocks are nearby?"</span>, </span>
<span>     ylab <span class="op">=</span> <span class="st">"Frequency (# of sites)"</span>, </span>
<span>     main <span class="op">=</span> <span class="st">"A given site may have zero to hundreds of blocks nearby"</span>, </span>
<span>     sub <span class="op">=</span> <span class="st">"A typical site in this example has about 100 blocks nearby"</span><span class="op">)</span></span></code></pre></div>
<div class="figure">
<img src="4_advanced_files/figure-html/histoblocks-1.png" alt="histogram with count of sites on y axis and how many blocks on x axis up to 6,000 showing huge share of sites have fewer than 500 blocks within 3 miles, but some have over 5,000 blocks within 3 miles of a single site." width="672"><p class="caption">
Example of Histogram and table showing how many blocks are within 3
miles of a site
</p>
</div>
<div class="sourceCode" id="cb49"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu">DT</span><span class="fu">::</span><span class="fu"><a href="https://rdrr.io/pkg/DT/man/datatable.html" class="external-link">datatable</a></span><span class="op">(</span><span class="va">s2b_stats</span>,  rownames <span class="op">=</span> <span class="cn">FALSE</span><span class="op">)</span></span>
<span><span class="co"># more summaries showing there may be only 1 block or hundreds within 1 mile</span></span></code></pre></div>
</div>
<div class="section level4">
<h4 id="summary-stats-on-how-many-blocks-are-within-each-radius">Summary stats on how many blocks are within each radius<a class="anchor" aria-label="anchor" href="#summary-stats-on-how-many-blocks-are-within-each-radius"></a>
</h4>
<div class="sourceCode" id="cb50"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co"># Just within 1 mile</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">sites2blocks</span><span class="op">[</span><span class="va">distance</span> <span class="op">&lt;=</span> <span class="fl">1</span>, <span class="va">.N</span>, by <span class="op">=</span> <span class="st">"ejam_uniq_id"</span><span class="op">]</span><span class="op">[</span>, <span class="va">N</span><span class="op">]</span><span class="op">)</span></span>
<span><span class="co"># or</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/stats/quantile.html" class="external-link">quantile</a></span><span class="op">(</span><span class="va">s2b_stats</span><span class="op">$</span><span class="va">blocks_within_1mile</span>, probs <span class="op">=</span> <span class="op">(</span><span class="fl">0</span><span class="op">:</span><span class="fl">4</span><span class="op">)</span> <span class="op">*</span> <span class="fl">0.25</span><span class="op">)</span></span>
<span></span>
<span><span class="co"># Within each distance</span></span>
<span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">s2b_stats</span><span class="op">)</span></span>
<span><span class="co"># t(summary(s2b_stats))</span></span></code></pre></div>
</div>
<div class="section level4">
<h4 id="map-all-sites-with-popup-at-each-saying-how-many-blocks-were-found-nearby">Map all sites with popup at each saying how many blocks were found
nearby<a class="anchor" aria-label="anchor" href="#map-all-sites-with-popup-at-each-saying-how-many-blocks-were-found-nearby"></a>
</h4>
<div class="sourceCode" id="cb51"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="co">## done previously:</span></span>
<span><span class="co"># radius &lt;- 3</span></span>
<span><span class="co"># sitepoints &lt;- testpoints_100</span></span>
<span></span>
<span><span class="va">out</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/ejamit.html">ejamit</a></span><span class="op">(</span>sitepoints <span class="op">=</span> <span class="va">sitepoints</span>, </span>
<span>              radius <span class="op">=</span> <span class="va">radius</span>, include_ejindexes <span class="op">=</span> <span class="cn">F</span><span class="op">)</span></span>
<span><span class="co">#&gt; Finding blocks nearby.</span></span>
<span><span class="co">#&gt; Analyzing 100 points, radius of 3 miles around each.</span></span>
<span><span class="co">#&gt; Aggregating at each site and overall.</span></span>
<span><span class="co">#&gt; Warning in batch.summarize(sitestats = data.frame(out$results_bysite), quiet =</span></span>
<span><span class="co">#&gt; quiet, : specified threshnames not all found in sitestats colnames, so using</span></span>
<span><span class="co">#&gt; defaults</span></span>
<span></span>
<span><span class="va">few</span> <span class="op">&lt;-</span> <span class="va">out</span><span class="op">$</span><span class="va">results_bysite</span><span class="op">$</span><span class="va">blockcount_near_site</span> <span class="op">&lt;</span> <span class="fl">30</span></span>
<span></span>
<span><span class="va">mapthis</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/cbind.html" class="external-link">cbind</a></span><span class="op">(</span></span>
<span>  <span class="va">sitepoints</span>, </span>
<span>  <span class="va">out</span><span class="op">$</span><span class="va">results_bysite</span><span class="op">[</span>, <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span></span>
<span>    <span class="st">"pop"</span>, <span class="st">"bgcount_near_site"</span>, <span class="st">"blockcount_near_site"</span></span>
<span>    <span class="op">)</span><span class="op">]</span>,</span>
<span>  NOTE <span class="op">=</span> <span class="fu"><a href="https://rdrr.io/r/base/ifelse.html" class="external-link">ifelse</a></span><span class="op">(</span><span class="va">few</span>, <span class="st">"&lt; 30 blocks here"</span>, <span class="st">""</span><span class="op">)</span></span>
<span>  <span class="op">)</span></span>
<span></span>
<span><span class="co"># Show in red the sites with very few blocks nearby, suggesting more uncertainty in demographic counts</span></span>
<span></span>
<span><span class="va">mm</span> <span class="op">&lt;-</span> <span class="fu"><a href="../reference/mapfast.html">mapfast</a></span><span class="op">(</span><span class="va">mapthis</span>, radius <span class="op">=</span> <span class="va">radius</span>, color <span class="op">=</span> <span class="st">'navy'</span><span class="op">)</span></span>
<span><span class="va">mm</span> <span class="op">|&gt;</span> <span class="fu">leaflet</span><span class="fu">::</span><span class="fu"><a href="https://rstudio.github.io/leaflet/reference/map-layers.html" class="external-link">addCircles</a></span><span class="op">(</span></span>
<span>    lng <span class="op">=</span> <span class="va">mapthis</span><span class="op">$</span><span class="va">lon</span><span class="op">[</span><span class="va">few</span><span class="op">]</span>, </span>
<span>    lat <span class="op">=</span> <span class="va">mapthis</span><span class="op">$</span><span class="va">lat</span><span class="op">[</span><span class="va">few</span><span class="op">]</span>, </span>
<span>    color <span class="op">=</span> <span class="st">"red"</span>, radius <span class="op">=</span> <span class="va">radius</span> <span class="op">*</span> <span class="fl">2</span> <span class="op">*</span> <span class="va">meters_per_mile</span>,</span>
<span>    popup <span class="op">=</span> <span class="fu"><a href="../reference/popup_from_any.html">popup_from_any</a></span><span class="op">(</span><span class="va">mapthis</span><span class="op">[</span><span class="va">few</span>, <span class="op">]</span><span class="op">)</span></span>
<span><span class="op">)</span></span></code></pre></div>
<div class="figure">
<div class="leaflet html-widget html-fill-item" id="htmlwidget-e5c8c404fe174e4c81bd" style="width:480px;height:480px;"></div>
<script type="application/json" data-for="htmlwidget-e5c8c404fe174e4c81bd">{"x":{"options":{"crs":{"crsClass":"L.CRS.EPSG3857","code":null,"proj4def":null,"projectedBounds":null,"options":{}}},"calls":[{"method":"addTiles","args":["https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",null,null,{"minZoom":0,"maxZoom":18,"tileSize":256,"subdomains":"abc","errorTileUrl":"","tms":false,"noWrap":false,"zoomOffset":0,"zoomReverse":false,"opacity":1,"zIndex":1,"detectRetina":false,"attribution":"&copy; <a href=\"https://openstreetmap.org/copyright/\">OpenStreetMap<\/a>,  <a href=\"https://opendatacommons.org/licenses/odbl/\">ODbL<\/a>"}]},{"method":"addCircles","args":[[40.66478,38.39657,40.34971,34.238356,41.351626,42.210608,33.83575,43.06623,44.33037,44.607389,44.5622,34.00255,42.84871,39.281609,39.1072,40.44519,41.55228,32.65896,41.18806,36.3733,41.765963,38.737189,34.320805,41.028894,40.55129,45.56802,45.54008,34.224205,44.54588,42.72435,34.105383,40.23321,46.90732,40.74836,38.39053,30.07394,33.40379,39.56686,33.228333,40.635226,42.676621,41.88805,25.91851,43.669225,37.8088,34.94638,34.065556,41.750688,36.61676,40.17353,38.54863,41.059085,44.8898,43.3463,30.182358,37.506654,45.51544,29.467922,36.911944,41.16786,41.56639,38.57299,39.188043,40.92497,33.368661,40.88991,46.666278,39.478111,33.699624,42.43759,33.75575,40.647771,44.865604,41.04158,40.7899,40.73868,47.70375,39.06548,38.59822,26.68223,38.19563,37.35819,33.5096,43.64384,42.45838,30.362953,39.62418,41.85287,33.727633,40.1942,33.18422,40.583031,45.56393,33.72709,42.727046,39.95224,37.52802,40.33382,36.8879,41.82161],[-74.89136999999999,-98.70086000000001,-79.84963999999999,-118.253428,-85.13566,-93.215351,-118.11689,-92.68472,-75.90884,-93.78310500000001,-74.905897,-118.1327,-106.3146,-121.858902,-84.61387999999999,-74.93169,-73.07089000000001,-117.10381,-103.67739,-84.23925,-87.663831,-122.145336,-111.00948,-76.466869,-89.25015,-94.5924,-122.64731,-118.607902,-70.55643000000001,-92.19929,-117.950665,-74.70677000000001,-95.06321,-74.24467,-90.58468000000001,-92.68047,-82.10532000000001,-75.0137,-97.303611,-73.967628,-83.239902,-87.848208,-97.44678999999999,-92.972261,-101.58307,-81.03807,-117.047222,-87.68286500000001,-88.32096,-74.02208,-90.37566,-73.765974,-89.51094000000001,-83.384,-85.72841699999999,-122.252962,-122.65868,-95.11463000000001,-83.919444,-111.96861,-73.918181,-121.49938,-120.834568,-72.69535999999999,-87.01028700000001,-124.08757,-112.514167,-96.07643899999999,-78.910265,-77.096585,-117.87106,-79.107394,-93.39997,-96.10195,-74.02005,-73.98324,-116.785747,-84.11596,-90.16107,-80.11203999999999,-86.97767,-120.74194,-112.1026,-70.98053,-93.80831000000001,-87.13959199999999,-86.47978999999999,-71.39655,-118.066351,-80.3128,-117.29259,-79.76570700000001,-94.94584999999999,-116.39837,-84.555521,-74.985556,-122.02633,-74.04594,-111.44425,-71.35842],4828.032,null,null,{"interactive":true,"className":"","stroke":true,"color":"navy","weight":5,"opacity":0.5,"fill":true,"fillColor":"navy","fillOpacity":0.2},["lat: 40.66478<br>lon: -74.89137<br>sitenumber: 1<br>sitename: Example Site 1<br>pop: 15281.4<br>bgcount_near_site: 20<br>blockcount_near_site: 341<br>NOTE: ","lat: 38.39657<br>lon: -98.70086<br>sitenumber: 2<br>sitename: Example Site 2<br>pop: 560.1<br>bgcount_near_site: 2<br>blockcount_near_site: 56<br>NOTE: ","lat: 40.34971<br>lon: -79.84964<br>sitenumber: 3<br>sitename: Example Site 3<br>pop: 56865.5<br>bgcount_near_site: 77<br>blockcount_near_site: 2111<br>NOTE: ","lat: 34.238356<br>lon: -118.253428<br>sitenumber: 4<br>sitename: Example Site 4<br>pop: 72470.3<br>bgcount_near_site: 65<br>blockcount_near_site: 735<br>NOTE: ","lat: 41.351626<br>lon: -85.13566<br>sitenumber: 5<br>sitename: Example Site 5<br>pop: 8243.7<br>bgcount_near_site: 11<br>blockcount_near_site: 405<br>NOTE: ","lat: 42.210608<br>lon: -93.215351<br>sitenumber: 6<br>sitename: Example Site 6<br>pop: 130.9<br>bgcount_near_site: 3<br>blockcount_near_site: 48<br>NOTE: ","lat: 33.83575<br>lon: -118.11689<br>sitenumber: 7<br>sitename: Example Site 7<br>pop: 195596.4<br>bgcount_near_site: 175<br>blockcount_near_site: 1861<br>NOTE: ","lat: 43.06623<br>lon: -92.68472<br>sitenumber: 8<br>sitename: Example Site 8<br>pop: 8149.7<br>bgcount_near_site: 11<br>blockcount_near_site: 443<br>NOTE: ","lat: 44.33037<br>lon: -75.90884<br>sitenumber: 9<br>sitename: Example Site 9<br>pop: 1858.9<br>bgcount_near_site: 5<br>blockcount_near_site: 108<br>NOTE: ","lat: 44.607389<br>lon: -93.783105<br>sitenumber: 10<br>sitename: Example Site 10<br>pop: 8047.8<br>bgcount_near_site: 9<br>blockcount_near_site: 223<br>NOTE: ","lat: 44.5622<br>lon: -74.905897<br>sitenumber: 11<br>sitename: Example Site 11<br>pop: 874.8<br>bgcount_near_site: 4<br>blockcount_near_site: 67<br>NOTE: ","lat: 34.00255<br>lon: -118.1327<br>sitenumber: 12<br>sitename: Example Site 12<br>pop: 222089.9<br>bgcount_near_site: 163<br>blockcount_near_site: 2370<br>NOTE: ","lat: 42.84871<br>lon: -106.3146<br>sitenumber: 13<br>sitename: Example Site 13<br>pop: 46056.5<br>bgcount_near_site: 42<br>blockcount_near_site: 1985<br>NOTE: ","lat: 39.281609<br>lon: -121.858902<br>sitenumber: 14<br>sitename: Example Site 14<br>pop: 46<br>bgcount_near_site: 2<br>blockcount_near_site: 11<br>NOTE: < 30 blocks here","lat: 39.1072<br>lon: -84.61388<br>sitenumber: 15<br>sitename: Example Site 15<br>pop: 95250.8<br>bgcount_near_site: 91<br>blockcount_near_site: 644<br>NOTE: ","lat: 40.44519<br>lon: -74.93169<br>sitenumber: 16<br>sitename: Example Site 16<br>pop: 4353.6<br>bgcount_near_site: 5<br>blockcount_near_site: 113<br>NOTE: ","lat: 41.55228<br>lon: -73.07089<br>sitenumber: 17<br>sitename: Example Site 17<br>pop: 90802.9<br>bgcount_near_site: 82<br>blockcount_near_site: 1139<br>NOTE: ","lat: 32.65896<br>lon: -117.10381<br>sitenumber: 18<br>sitename: Example Site 18<br>pop: 162129.9<br>bgcount_near_site: 105<br>blockcount_near_site: 1370<br>NOTE: ","lat: 41.18806<br>lon: -103.67739<br>sitenumber: 19<br>sitename: Example Site 19<br>pop: 261.8<br>bgcount_near_site: 3<br>blockcount_near_site: 37<br>NOTE: ","lat: 36.3733<br>lon: -84.23925<br>sitenumber: 20<br>sitename: Example Site 20<br>pop: 5.4<br>bgcount_near_site: 3<br>blockcount_near_site: 53<br>NOTE: ","lat: 41.765963<br>lon: -87.663831<br>sitenumber: 21<br>sitename: Example Site 21<br>pop: 302668<br>bgcount_near_site: 322<br>blockcount_near_site: 5735<br>NOTE: ","lat: 38.737189<br>lon: -122.145336<br>sitenumber: 22<br>sitename: Example Site 22<br>pop: 88.3<br>bgcount_near_site: 2<br>blockcount_near_site: 20<br>NOTE: < 30 blocks here","lat: 34.320805<br>lon: -111.00948<br>sitenumber: 23<br>sitename: Example Site 23<br>pop: 165.3<br>bgcount_near_site: 2<br>blockcount_near_site: 31<br>NOTE: ","lat: 41.028894<br>lon: -76.466869<br>sitenumber: 24<br>sitename: Example Site 24<br>pop: 19108<br>bgcount_near_site: 21<br>blockcount_near_site: 621<br>NOTE: ","lat: 40.55129<br>lon: -89.25015<br>sitenumber: 25<br>sitename: Example Site 25<br>pop: 664.6<br>bgcount_near_site: 3<br>blockcount_near_site: 47<br>NOTE: ","lat: 45.56802<br>lon: -94.5924<br>sitenumber: 26<br>sitename: Example Site 26<br>pop: 732.9<br>bgcount_near_site: 2<br>blockcount_near_site: 32<br>NOTE: ","lat: 45.54008<br>lon: -122.64731<br>sitenumber: 27<br>sitename: Example Site 27<br>pop: 237219.4<br>bgcount_near_site: 228<br>blockcount_near_site: 5432<br>NOTE: ","lat: 34.224205<br>lon: -118.607902<br>sitenumber: 28<br>sitename: Example Site 28<br>pop: 198704.9<br>bgcount_near_site: 132<br>blockcount_near_site: 1255<br>NOTE: ","lat: 44.54588<br>lon: -70.55643<br>sitenumber: 29<br>sitename: Example Site 29<br>pop: 7006.3<br>bgcount_near_site: 8<br>blockcount_near_site: 204<br>NOTE: ","lat: 42.72435<br>lon: -92.19929<br>sitenumber: 30<br>sitename: Example Site 30<br>pop: 1081.4<br>bgcount_near_site: 4<br>blockcount_near_site: 95<br>NOTE: ","lat: 34.105383<br>lon: -117.950665<br>sitenumber: 31<br>sitename: Example Site 31<br>pop: 160145.4<br>bgcount_near_site: 120<br>blockcount_near_site: 1405<br>NOTE: ","lat: 40.23321<br>lon: -74.70677<br>sitenumber: 32<br>sitename: Example Site 32<br>pop: 132705.3<br>bgcount_near_site: 100<br>blockcount_near_site: 1984<br>NOTE: ","lat: 46.90732<br>lon: -95.06321<br>sitenumber: 33<br>sitename: Example Site 33<br>pop: 5586.1<br>bgcount_near_site: 6<br>blockcount_near_site: 287<br>NOTE: ","lat: 40.74836<br>lon: -74.24467<br>sitenumber: 34<br>sitename: Example Site 34<br>pop: 343123.8<br>bgcount_near_site: 306<br>blockcount_near_site: 2806<br>NOTE: ","lat: 38.39053<br>lon: -90.58468<br>sitenumber: 35<br>sitename: Example Site 35<br>pop: 5590.9<br>bgcount_near_site: 12<br>blockcount_near_site: 139<br>NOTE: ","lat: 30.07394<br>lon: -92.68047<br>sitenumber: 36<br>sitename: Example Site 36<br>pop: 3345.2<br>bgcount_near_site: 6<br>blockcount_near_site: 147<br>NOTE: ","lat: 33.40379<br>lon: -82.10532<br>sitenumber: 37<br>sitename: Example Site 37<br>pop: 39928.4<br>bgcount_near_site: 29<br>blockcount_near_site: 391<br>NOTE: ","lat: 39.56686<br>lon: -75.0137<br>sitenumber: 38<br>sitename: Example Site 38<br>pop: 9370.1<br>bgcount_near_site: 14<br>blockcount_near_site: 219<br>NOTE: ","lat: 33.228333<br>lon: -97.303611<br>sitenumber: 39<br>sitename: Example Site 39<br>pop: 2576.1<br>bgcount_near_site: 6<br>blockcount_near_site: 54<br>NOTE: ","lat: 40.635226<br>lon: -73.967628<br>sitenumber: 40<br>sitename: Example Site 40<br>pop: 1268259.8<br>bgcount_near_site: 1036<br>blockcount_near_site: 4079<br>NOTE: ","lat: 42.676621<br>lon: -83.239902<br>sitenumber: 41<br>sitename: Example Site 41<br>pop: 50143.9<br>bgcount_near_site: 60<br>blockcount_near_site: 683<br>NOTE: ","lat: 41.88805<br>lon: -87.848208<br>sitenumber: 42<br>sitename: Example Site 42<br>pop: 178302.7<br>bgcount_near_site: 170<br>blockcount_near_site: 3696<br>NOTE: ","lat: 25.91851<br>lon: -97.44679<br>sitenumber: 43<br>sitename: Example Site 43<br>pop: 92683.5<br>bgcount_near_site: 86<br>blockcount_near_site: 1106<br>NOTE: ","lat: 43.669225<br>lon: -92.972261<br>sitenumber: 44<br>sitename: Example Site 44<br>pop: 26824.2<br>bgcount_near_site: 25<br>blockcount_near_site: 744<br>NOTE: ","lat: 37.8088<br>lon: -101.58307<br>sitenumber: 45<br>sitename: Example Site 45<br>pop: 17.1<br>bgcount_near_site: 1<br>blockcount_near_site: 13<br>NOTE: < 30 blocks here","lat: 34.94638<br>lon: -81.03807<br>sitenumber: 46<br>sitename: Example Site 46<br>pop: 56802.7<br>bgcount_near_site: 51<br>blockcount_near_site: 1085<br>NOTE: ","lat: 34.065556<br>lon: -117.047222<br>sitenumber: 47<br>sitename: Example Site 47<br>pop: 31079.1<br>bgcount_near_site: 23<br>blockcount_near_site: 312<br>NOTE: ","lat: 41.750688<br>lon: -87.682865<br>sitenumber: 48<br>sitename: Example Site 48<br>pop: 271866.3<br>bgcount_near_site: 280<br>blockcount_near_site: 5243<br>NOTE: ","lat: 36.61676<br>lon: -88.32096<br>sitenumber: 49<br>sitename: Example Site 49<br>pop: 20555.2<br>bgcount_near_site: 21<br>blockcount_near_site: 583<br>NOTE: ","lat: 40.17353<br>lon: -74.02208<br>sitenumber: 50<br>sitename: Example Site 50<br>pop: 53446.2<br>bgcount_near_site: 66<br>blockcount_near_site: 1541<br>NOTE: ","lat: 38.54863<br>lon: -90.37566<br>sitenumber: 51<br>sitename: Example Site 51<br>pop: 83095.2<br>bgcount_near_site: 77<br>blockcount_near_site: 1213<br>NOTE: ","lat: 41.059085<br>lon: -73.765974<br>sitenumber: 52<br>sitename: Example Site 52<br>pop: 92037.7<br>bgcount_near_site: 77<br>blockcount_near_site: 1213<br>NOTE: ","lat: 44.8898<br>lon: -89.51094<br>sitenumber: 53<br>sitename: Example Site 53<br>pop: 6077.3<br>bgcount_near_site: 9<br>blockcount_near_site: 155<br>NOTE: ","lat: 43.3463<br>lon: -83.384<br>sitenumber: 54<br>sitename: Example Site 54<br>pop: 2530.1<br>bgcount_near_site: 7<br>blockcount_near_site: 97<br>NOTE: ","lat: 30.182358<br>lon: -85.728417<br>sitenumber: 55<br>sitename: Example Site 55<br>pop: 29800.3<br>bgcount_near_site: 25<br>blockcount_near_site: 715<br>NOTE: ","lat: 37.506654<br>lon: -122.252962<br>sitenumber: 56<br>sitename: Example Site 56<br>pop: 132726.8<br>bgcount_near_site: 105<br>blockcount_near_site: 1559<br>NOTE: ","lat: 45.51544<br>lon: -122.65868<br>sitenumber: 57<br>sitename: Example Site 57<br>pop: 220647.9<br>bgcount_near_site: 216<br>blockcount_near_site: 4596<br>NOTE: ","lat: 29.467922<br>lon: -95.11463<br>sitenumber: 58<br>sitename: Example Site 58<br>pop: 59740.2<br>bgcount_near_site: 60<br>blockcount_near_site: 650<br>NOTE: ","lat: 36.911944<br>lon: -83.919444<br>sitenumber: 59<br>sitename: Example Site 59<br>pop: 3542<br>bgcount_near_site: 9<br>blockcount_near_site: 103<br>NOTE: ","lat: 41.16786<br>lon: -111.96861<br>sitenumber: 60<br>sitename: Example Site 60<br>pop: 63640.1<br>bgcount_near_site: 58<br>blockcount_near_site: 1004<br>NOTE: ","lat: 41.56639<br>lon: -73.918181<br>sitenumber: 61<br>sitename: Example Site 61<br>pop: 33926<br>bgcount_near_site: 40<br>blockcount_near_site: 463<br>NOTE: ","lat: 38.57299<br>lon: -121.49938<br>sitenumber: 62<br>sitename: Example Site 62<br>pop: 139992.7<br>bgcount_near_site: 142<br>blockcount_near_site: 2813<br>NOTE: ","lat: 39.188043<br>lon: -120.834568<br>sitenumber: 63<br>sitename: Example Site 63<br>pop: 1403.5<br>bgcount_near_site: 6<br>blockcount_near_site: 107<br>NOTE: ","lat: 40.92497<br>lon: -72.69536<br>sitenumber: 64<br>sitename: Example Site 64<br>pop: 23004.6<br>bgcount_near_site: 21<br>blockcount_near_site: 346<br>NOTE: ","lat: 33.368661<br>lon: -87.010287<br>sitenumber: 65<br>sitename: Example Site 65<br>pop: 16470.1<br>bgcount_near_site: 25<br>blockcount_near_site: 516<br>NOTE: ","lat: 40.88991<br>lon: -124.08757<br>sitenumber: 66<br>sitename: Example Site 66<br>pop: 21581.3<br>bgcount_near_site: 21<br>blockcount_near_site: 550<br>NOTE: ","lat: 46.666278<br>lon: -112.514167<br>sitenumber: 67<br>sitename: Example Site 67<br>pop: 6.1<br>bgcount_near_site: 1<br>blockcount_near_site: 14<br>NOTE: < 30 blocks here","lat: 39.478111<br>lon: -96.076439<br>sitenumber: 68<br>sitename: Example Site 68<br>pop: 302<br>bgcount_near_site: 2<br>blockcount_near_site: 52<br>NOTE: ","lat: 33.699624<br>lon: -78.910265<br>sitenumber: 69<br>sitename: Example Site 69<br>pop: 33840<br>bgcount_near_site: 25<br>blockcount_near_site: 916<br>NOTE: ","lat: 42.43759<br>lon: -77.096585<br>sitenumber: 70<br>sitename: Example Site 70<br>pop: 1322<br>bgcount_near_site: 4<br>blockcount_near_site: 103<br>NOTE: ","lat: 33.75575<br>lon: -117.87106<br>sitenumber: 71<br>sitename: Example Site 71<br>pop: 333232.5<br>bgcount_near_site: 185<br>blockcount_near_site: 2317<br>NOTE: ","lat: 40.647771<br>lon: -79.107394<br>sitenumber: 72<br>sitename: Example Site 72<br>pop: 10647.2<br>bgcount_near_site: 16<br>blockcount_near_site: 324<br>NOTE: ","lat: 44.865604<br>lon: -93.39997<br>sitenumber: 73<br>sitename: Example Site 73<br>pop: 57916.4<br>bgcount_near_site: 70<br>blockcount_near_site: 786<br>NOTE: ","lat: 41.04158<br>lon: -96.10195<br>sitenumber: 74<br>sitename: Example Site 74<br>pop: 1720.4<br>bgcount_near_site: 6<br>blockcount_near_site: 67<br>NOTE: ","lat: 40.7899<br>lon: -74.02005<br>sitenumber: 75<br>sitename: Example Site 75<br>pop: 596162.5<br>bgcount_near_site: 448<br>blockcount_near_site: 2346<br>NOTE: ","lat: 40.73868<br>lon: -73.98324<br>sitenumber: 76<br>sitename: Example Site 76<br>pop: 1150306.5<br>bgcount_near_site: 992<br>blockcount_near_site: 4258<br>NOTE: ","lat: 47.70375<br>lon: -116.785747<br>sitenumber: 77<br>sitename: Example Site 77<br>pop: 53874.8<br>bgcount_near_site: 38<br>blockcount_near_site: 1224<br>NOTE: ","lat: 39.06548<br>lon: -84.11596<br>sitenumber: 78<br>sitename: Example Site 78<br>pop: 8112.4<br>bgcount_near_site: 10<br>blockcount_near_site: 168<br>NOTE: ","lat: 38.59822<br>lon: -90.16107<br>sitenumber: 79<br>sitename: Example Site 79<br>pop: 32563.4<br>bgcount_near_site: 47<br>blockcount_near_site: 1739<br>NOTE: ","lat: 26.68223<br>lon: -80.11204<br>sitenumber: 80<br>sitename: Example Site 80<br>pop: 133429.4<br>bgcount_near_site: 92<br>blockcount_near_site: 1205<br>NOTE: ","lat: 38.19563<br>lon: -86.97767<br>sitenumber: 81<br>sitename: Example Site 81<br>pop: 2088.1<br>bgcount_near_site: 7<br>blockcount_near_site: 139<br>NOTE: ","lat: 37.35819<br>lon: -120.74194<br>sitenumber: 82<br>sitename: Example Site 82<br>pop: 14985.8<br>bgcount_near_site: 12<br>blockcount_near_site: 247<br>NOTE: ","lat: 33.5096<br>lon: -112.1026<br>sitenumber: 83<br>sitename: Example Site 83<br>pop: 182718.6<br>bgcount_near_site: 140<br>blockcount_near_site: 1875<br>NOTE: ","lat: 43.64384<br>lon: -70.98053<br>sitenumber: 84<br>sitename: Example Site 84<br>pop: 2022.7<br>bgcount_near_site: 8<br>blockcount_near_site: 127<br>NOTE: ","lat: 42.45838<br>lon: -93.80831<br>sitenumber: 85<br>sitename: Example Site 85<br>pop: 7980.1<br>bgcount_near_site: 9<br>blockcount_near_site: 357<br>NOTE: ","lat: 30.362953<br>lon: -87.139592<br>sitenumber: 86<br>sitename: Example Site 86<br>pop: 12776.1<br>bgcount_near_site: 12<br>blockcount_near_site: 193<br>NOTE: ","lat: 39.62418<br>lon: -86.47979<br>sitenumber: 87<br>sitename: Example Site 87<br>pop: 4657.5<br>bgcount_near_site: 5<br>blockcount_near_site: 100<br>NOTE: ","lat: 41.85287<br>lon: -71.39655<br>sitenumber: 88<br>sitename: Example Site 88<br>pop: 213311.9<br>bgcount_near_site: 189<br>blockcount_near_site: 3857<br>NOTE: ","lat: 33.727633<br>lon: -118.066351<br>sitenumber: 89<br>sitename: Example Site 89<br>pop: 68079.4<br>bgcount_near_site: 62<br>blockcount_near_site: 848<br>NOTE: ","lat: 40.1942<br>lon: -80.3128<br>sitenumber: 90<br>sitename: Example Site 90<br>pop: 13797.5<br>bgcount_near_site: 20<br>blockcount_near_site: 377<br>NOTE: ","lat: 33.18422<br>lon: -117.29259<br>sitenumber: 91<br>sitename: Example Site 91<br>pop: 121075.6<br>bgcount_near_site: 84<br>blockcount_near_site: 837<br>NOTE: ","lat: 40.583031<br>lon: -79.765707<br>sitenumber: 92<br>sitename: Example Site 92<br>pop: 41090.9<br>bgcount_near_site: 49<br>blockcount_near_site: 1311<br>NOTE: ","lat: 45.56393<br>lon: -94.94585<br>sitenumber: 93<br>sitename: Example Site 93<br>pop: 446.1<br>bgcount_near_site: 2<br>blockcount_near_site: 58<br>NOTE: ","lat: 33.72709<br>lon: -116.39837<br>sitenumber: 94<br>sitename: Example Site 94<br>pop: 37296<br>bgcount_near_site: 44<br>blockcount_near_site: 715<br>NOTE: ","lat: 42.727046<br>lon: -84.555521<br>sitenumber: 95<br>sitename: Example Site 95<br>pop: 90133.3<br>bgcount_near_site: 113<br>blockcount_near_site: 2000<br>NOTE: ","lat: 39.95224<br>lon: -74.985556<br>sitenumber: 96<br>sitename: Example Site 96<br>pop: 83055.3<br>bgcount_near_site: 73<br>blockcount_near_site: 1325<br>NOTE: ","lat: 37.52802<br>lon: -122.02633<br>sitenumber: 97<br>sitename: Example Site 97<br>pop: 132562.5<br>bgcount_near_site: 81<br>blockcount_near_site: 1223<br>NOTE: ","lat: 40.33382<br>lon: -74.04594<br>sitenumber: 98<br>sitename: Example Site 98<br>pop: 62713.7<br>bgcount_near_site: 64<br>blockcount_near_site: 1057<br>NOTE: ","lat: 36.8879<br>lon: -111.44425<br>sitenumber: 99<br>sitename: Example Site 99<br>pop: 8581.9<br>bgcount_near_site: 9<br>blockcount_near_site: 170<br>NOTE: ","lat: 41.82161<br>lon: -71.35842<br>sitenumber: 100<br>sitename: Example Site 100<br>pop: 93198.5<br>bgcount_near_site: 93<br>blockcount_near_site: 2077<br>NOTE: "],{"maxHeight":400,"maxWidth":850},null,{"interactive":false,"permanent":false,"direction":"auto","opacity":1,"offset":[0,0],"textsize":"10px","textOnly":false,"className":"","sticky":true},null,null]},{"method":"addEasyprint","args":[{"title":"Print map","position":"topleft","sizeModes":["A4Portrait","A4Landscape","CurrentSize"],"exportOnly":false,"tileWait":500,"filename":"map","hidden":false,"hideControlContainer":true,"spinnerBgColor":"#0DC5C1","customSpinnerClass":"epLoader"}]},{"method":"addCircles","args":[[39.281609,38.737189,37.8088,46.666278],[-121.858902,-122.145336,-101.58307,-112.514167],9656.064,null,null,{"interactive":true,"className":"","stroke":true,"color":"red","weight":5,"opacity":0.5,"fill":true,"fillColor":"red","fillOpacity":0.2},["lat: 39.281609<br>lon: -121.858902<br>sitenumber: 14<br>sitename: Example Site 14<br>pop: 46<br>bgcount_near_site: 2<br>blockcount_near_site: 11<br>NOTE: < 30 blocks here","lat: 38.737189<br>lon: -122.145336<br>sitenumber: 22<br>sitename: Example Site 22<br>pop: 88.3<br>bgcount_near_site: 2<br>blockcount_near_site: 20<br>NOTE: < 30 blocks here","lat: 37.8088<br>lon: -101.58307<br>sitenumber: 45<br>sitename: Example Site 45<br>pop: 17.1<br>bgcount_near_site: 1<br>blockcount_near_site: 13<br>NOTE: < 30 blocks here","lat: 46.666278<br>lon: -112.514167<br>sitenumber: 67<br>sitename: Example Site 67<br>pop: 6.1<br>bgcount_near_site: 1<br>blockcount_near_site: 14<br>NOTE: < 30 blocks here"],null,null,{"interactive":false,"permanent":false,"direction":"auto","opacity":1,"offset":[0,0],"textsize":"10px","textOnly":false,"className":"","sticky":true},null,null]}],"limits":{"lat":[25.91851,47.70375],"lng":[-124.08757,-70.55643000000001]}},"evals":[],"jsHooks":[]}</script><p class="caption">
Example of mapfast() for seeing how many blocks are at each site
</p>
</div>
<div class="section level5">
<h5 id="some-places-have-very-few-if-any-blocks-within-1-mile">Some places have very few – if any – blocks within 1 mile<a class="anchor" aria-label="anchor" href="#some-places-have-very-few-if-any-blocks-within-1-mile"></a>
</h5>
<div class="sourceCode" id="cb52"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">tail</a></span><span class="op">(</span><span class="va">s2b_stats</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/order.html" class="external-link">order</a></span><span class="op">(</span><span class="va">s2b_stats</span><span class="op">$</span><span class="va">blocks_within_1mile</span>, decreasing <span class="op">=</span> <span class="cn">T</span><span class="op">)</span>, </span>
<span>               <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">'ejam_uniq_id'</span>, <span class="st">'blocks_within_1mile'</span><span class="op">)</span><span class="op">]</span>, <span class="fl">3</span><span class="op">)</span> </span>
<span><span class="co">#&gt;    ejam_uniq_id blocks_within_1mile</span></span>
<span><span class="co">#&gt;           &lt;int&gt;               &lt;int&gt;</span></span>
<span><span class="co">#&gt; 1:           68                   2</span></span>
<span><span class="co">#&gt; 2:           14                   1</span></span>
<span><span class="co">#&gt; 3:           19                   1</span></span></code></pre></div>
</div>
<div class="section level5">
<h5 id="some-places-have-hundreds-nearby-a-1-mile-radius-is-huge-within-a-dense-urban-area">Some places have hundreds nearby: a 1 mile radius is huge within a
dense urban area<a class="anchor" aria-label="anchor" href="#some-places-have-hundreds-nearby-a-1-mile-radius-is-huge-within-a-dense-urban-area"></a>
</h5>
<div class="sourceCode" id="cb53"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/utils/head.html" class="external-link">head</a></span><span class="op">(</span><span class="va">s2b_stats</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/order.html" class="external-link">order</a></span><span class="op">(</span><span class="va">s2b_stats</span><span class="op">$</span><span class="va">blocks_within_1mile</span>, decreasing <span class="op">=</span> <span class="cn">T</span><span class="op">)</span>, </span>
<span>               <span class="fu"><a href="https://rdrr.io/r/base/c.html" class="external-link">c</a></span><span class="op">(</span><span class="st">'ejam_uniq_id'</span>, <span class="st">'blocks_within_1mile'</span><span class="op">)</span><span class="op">]</span>, <span class="fl">3</span><span class="op">)</span></span>
<span><span class="co">#&gt;    ejam_uniq_id blocks_within_1mile</span></span>
<span><span class="co">#&gt;           &lt;int&gt;               &lt;int&gt;</span></span>
<span><span class="co">#&gt; 1:           57                 791</span></span>
<span><span class="co">#&gt; 2:           42                 762</span></span>
<span><span class="co">#&gt; 3:           21                 732</span></span></code></pre></div>
<div class="sourceCode" id="cb54"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="va">densest</span> <span class="op">&lt;-</span> <span class="va">s2b_stats</span><span class="op">$</span><span class="va">ejam_uniq_id</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/order.html" class="external-link">order</a></span><span class="op">(</span></span>
<span>  <span class="va">s2b_stats</span><span class="op">$</span><span class="va">blocks_within_1mile</span>, decreasing <span class="op">=</span> <span class="cn">T</span><span class="op">)</span><span class="op">]</span><span class="op">[</span><span class="fl">1</span><span class="op">]</span></span>
<span><span class="va">leastdense</span> <span class="op">&lt;-</span> <span class="va">s2b_stats</span><span class="op">$</span><span class="va">ejam_uniq_id</span><span class="op">[</span><span class="fu"><a href="https://rdrr.io/r/base/order.html" class="external-link">order</a></span><span class="op">(</span></span>
<span>    <span class="va">s2b_stats</span><span class="op">$</span><span class="va">blocks_within_1mile</span>, decreasing <span class="op">=</span> <span class="cn">F</span><span class="op">)</span><span class="op">]</span><span class="op">[</span><span class="fl">1</span><span class="op">]</span></span></code></pre></div>
<pre><code><span><span class="co">#&gt; Analyzing 1 points, radius of 3 miles around each.</span></span>
<span><span class="co">#&gt; Finding Census blocks with internal point within  3  miles of the site (point), for each of 1  sites (points)...</span></span>
<span><span class="co">#&gt; Stats via getblocks_diagnostics(), but NOT ADJUSTING UP FOR VERY SHORT DISTANCES: </span></span>
<span><span class="co">#&gt; min distance before adjustment:  0.02342987 </span></span>
<span><span class="co">#&gt; max distance before adjustment:  6.646285</span></span></code></pre>
<div class="sourceCode" id="cb56"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/plotblocksnearby.html">plotblocksnearby</a></span><span class="op">(</span>sitepoints <span class="op">=</span> <span class="va">sitepoints</span><span class="op">[</span><span class="va">densest</span>, <span class="op">]</span><span class="op">)</span></span></code></pre></div>
<pre><code><span><span class="co">#&gt; Analyzing 1 points, radius of 3 miles around each.</span></span>
<span><span class="co">#&gt; Finding Census blocks with internal point within  3  miles of the site (point), for each of 1  sites (points)...</span></span>
<span><span class="co">#&gt; Stats via getblocks_diagnostics(), but NOT ADJUSTING UP FOR VERY SHORT DISTANCES: </span></span>
<span><span class="co">#&gt; min distance before adjustment:  0.5222611 </span></span>
<span><span class="co">#&gt; max distance before adjustment:  5.281615</span></span></code></pre>
<div class="sourceCode" id="cb58"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="../reference/plotblocksnearby.html">plotblocksnearby</a></span><span class="op">(</span>sitepoints <span class="op">=</span> <span class="va">sitepoints</span><span class="op">[</span> <span class="va">leastdense</span>, <span class="op">]</span><span class="op">)</span></span></code></pre></div>
<p>Within a 1 mile radius, the blocks found tend to be about 2/3 of a
mile from the site at the center.</p>
<div class="sourceCode" id="cb59"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span><span class="fu"><a href="https://rdrr.io/r/base/summary.html" class="external-link">summary</a></span><span class="op">(</span><span class="va">s2b_stats</span><span class="op">$</span><span class="va">avgDistance</span><span class="op">)</span></span>
<span><span class="co">#&gt;    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. </span></span>
<span><span class="co">#&gt;   0.900   1.765   1.930   1.853   2.033   2.500</span></span></code></pre></div>
</div>
</div>
</div>
</div>
  </main><aside class="col-md-3"><nav id="toc" aria-label="Table of contents"><h2>On this page</h2>
    </nav></aside>
</div>



    <footer><div class="pkgdown-footer-left">
  <p>US EPA 2025</p>
</div>

<div class="pkgdown-footer-right">
  <p>EJAM Version 2.32.0</p>
</div>

    </footer>
</div>





  </body>
</html>
